feat: add Nix flake for NixOS/Nix support#48
Merged
Conversation
- Add flake.nix with buildGoModule package definition, default app, and dev shell - Update README.md with Nix install instructions and platform table entry - Update docs/distribution.md with Nix flake section Fixes #36
There was a problem hiding this comment.
Pull request overview
Adds initial Nix flake support for building and running OpenPass through the Nix ecosystem, alongside documentation updates for the new install channel.
Changes:
- Adds
flake.nixwith a Go package, default app, and development shell. - Documents Nix flake usage in README and distribution docs.
- Updates support tables to list NixOS/Nix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
README.md |
Adds Nix install instructions and platform table entry. |
flake.nix |
Defines Nix package/app/dev shell for OpenPass. |
docs/distribution.md |
Adds NixOS/Nix support entry and Nix flake install section. |
Comments suppressed due to low confidence (1)
flake.nix:29
- Leaving
vendorHashempty makes thebuildGoModulederivation fail before it can build OpenPass, sonix build/nix runwill not work for users and the Go dependency set is not pinned. This needs to be replaced with the real SRI hash before the flake can satisfy the Nix support acceptance criteria.
vendorHash = "";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+5
to
+6
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| flake-utils.url = "github:numtide/flake-utils"; |
|
|
||
| # Disable CGO for Linux — reduces distributability and is not needed | ||
| # (keyring integration requires CGO only on darwin). | ||
| CGO_ENABLED = 0; |
Comment on lines
+53
to
+55
| apps.default = flake-utils.lib.mkApp { | ||
| drv = self.packages.${system}.default; | ||
| }; |
Comment on lines
+59
to
+68
| ```bash | ||
| # Run directly (no install needed) | ||
| nix run github:danieljustus/OpenPass | ||
|
|
||
| # Or add as a flake input | ||
| # flake.nix: | ||
| # inputs.openpass.url = "github:danieljustus/OpenPass"; | ||
| ``` | ||
| > **Note:** The flake is new. Run `nix build` once to resolve the Go module dependency hash (`vendorHash` in `flake.nix`), then submit a PR with the pinned hash. | ||
|
|
| # inputs.openpass.url = "github:danieljustus/OpenPass"; | ||
| ``` | ||
|
|
||
| > **Note:** The flake is new. Run `nix build` once to resolve the Go module dependency hash (`vendorHash` in `flake.nix`), then submit a PR with the pinned hash. |
| pkgs = import nixpkgs { inherit system; }; | ||
| in | ||
| { | ||
| packages.default = pkgs.buildGoModule { |
Replace the placeholder vendorHash with the resolved SRI hash for Go module dependencies. Updates docs to reflect that vendorHash is now pinned and provides instructions for updating it when dependencies change. Refs #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
flake.nixusingbuildGoModulefor reproducible Nix buildsDetails
The flake provides:
packages.default— OpenPass built viabuildGoModule(CGO_ENABLED=0 for Linux)apps.default—nix run github:danieljustus/OpenPasssupportdevShells.default— development shell with Go toolingNote:
vendorHashis set to""and needs to be resolved on firstnix build. The build will fail with the correct SRI hash — copy it intoflake.nixto pin Go dependencies.Fixes #36