-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: explicitly declare flake-parts input #97
fix: explicitly declare flake-parts input #97
Conversation
cameronraysmith
commented
Feb 23, 2025
•
edited
Loading
edited
- resolves flake-parts is an undeclared input to the top-level and all language template flakes #96
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
57c8075
to
56d7d5b
Compare
I'm currently not seeing any benefit from making this import explicit. Could you please elaborate why this |
Try to update a lockfile from any of the flakes without it as described in #96 (comment). All of them just use
In contrast to the case for the current HEAD of main on this repository described in the issue and quoted above for 6b348b2, performing the same from the source branch of this PR works as expected ❯ nix flake init -t github:cameronraysmith/kickstart.nix/requires-flake-parts-input#rust
wrote: /home/user/projects/kickstart-nix-rust-fix/Cargo.toml
wrote: /home/user/projects/kickstart-nix-rust-fix/.envrc
wrote: /home/user/projects/kickstart-nix-rust-fix/Cargo.lock
wrote: /home/user/projects/kickstart-nix-rust-fix/.gitignore
wrote: /home/user/projects/kickstart-nix-rust-fix/flake.nix
wrote: /home/user/projects/kickstart-nix-rust-fix/src/main.rs
wrote: /home/user/projects/kickstart-nix-rust-fix/src
direnv: error /home/user/projects/kickstart-nix-rust-fix/.envrc is blocked. Run `direnv allow` to approve its content
❯ nix build .
warning: creating lock file '/home/user/projects/kickstart-nix-rust-fix/flake.lock':
• Added input 'flake-parts':
'github:hercules-ci/flake-parts/32ea77a06711b758da0ad9bd6a844c5740a87abd?narHash=sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm%2BzmZ7vxbJdo%3D' (2025-02-01)
• Added input 'flake-parts/nixpkgs-lib':
'https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz?narHash=sha256-vJzFZGaCpnmo7I6i416HaBLpC%2BhvcURh/BQwROcGIp8%3D' (2025-02-01)
• Added input 'nixpkgs':
'github:NixOS/nixpkgs/32fb99ba93fea2798be0e997ea331dd78167f814?narHash=sha256-ozoOtE2hGsqh4XkTJFsrTkNxkRgShxpQxDynaPZUGxk%3D' (2025-02-21)
evaluation warning: rustPlatform.fetchCargoTarball is deprecated in favor of rustPlatform.fetchCargoVendor.
If you are using buildRustPackage, try setting useFetchCargoVendor = true and regenerating cargoHash.
See the 25.05 release notes for more information.
❯ tree --du -ah result
[436K] result
└── [436K] bin
└── [436K] example
436K used in 2 directories, 1 file
❯ ./result/bin/example
Hello, world! |
@Sironheart your https://github.com/Sironheart/nix-config contains the same issue. |
@erikreinert I think this would need to be decided on your part... I actually don't think this is an issue that 'new' users need to know about for now. |
@Sironheart can you explain why this is the case in your view with some direct reference to the evidence I have provided in response to your initial question above and the issue #96 ? All of the templates are broken as I illustrated with the rust template unless you happen to have flake-parts in a flake registry you subscribe to (#96 (comment)). You may happen to have a system in this state if you installed nix/nixos/nix-darwin with a template in this repository, but if you installed nix separately without access to the global flake registry you wouldn't be able to use these language-specific templates without being a new user who understands they all rely on an implicit input that you need to declare manually immediately after instantiating the template. Moreover, the fix is incredibly simple. |
Would you expect to be guided in learning a new language with a function
that you should begin using it as
which will return 7 because y is declared "somewhere else" to have a value of 6, or have evaluating this throw an error telling you that y is unbound and require binding the arguments of the function in order to evaluate it? Moreover, is the command line workflow outlined in #96 (comment) simpler than adding one line to the flake.nix file? |
This is fine to me. I was slightly worried about this when I originally did it. The only reason why it wasn't explicitly added was because it was how they had it in their |
That makes sense. They decided to perform the same update upstream in hercules-ci/flake-parts#210, so now these are in sync again. |