Cannot nixpkgs.callPackage the default.nix #32
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/flake-compat#32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I put
in my default.nix and also
in my flake.nix. But when I try putting this in my configuration.nix
and doing
sudo nixos-rebuild switchI get the following error:nix-buildworks fine. But callPackage does not work. How can I fix this?The
default.nixat the root of a project is not supposed to be called with withcallPackage. This is a little bit confusing (at least it was for me), but let me try to explain:There are two types of
default.nixfiles that are commonly used. The ones (typically at the root of a project) that get fed intonix-build, and the ones (typically innixpkgs) that get fed intocallPackage.nix-buildexpects a file with just a derivation in it.callPackageexpects a function from things innixpkgsto a derivation.In other words, you should be able to just remove
pkgs.callPackage, since yourdefault.nixis just a derivation, it's not a function that needs to be applied to anything.@Radvendii Hi. I'm glad I've found your comment. I had the same issues as OP. However when I apply your suggestion I get another error:
rustshop/rustshop@6a31b6fba0/infra/flake.nix (L18)I had to remove
{}as well. Is there anything else that is obvious that I'm missing? (I'm still a Nix noob)After playing with repl I'm even more confused: https://discourse.nixos.org/t/different-result-on-import-path-default-nix-in-flake-nix-vs-repl/19997 - I'm able to get the derivation in
nix repl(with(import ./path/default.nix).defaultbut not in myflake.nix.I think it is breaking because
builtins.currentsystemEdit: I was right! Here is the workaround that worked for me:
rustshop/rustshop@26824e3eb1In case it helps someone else, I ran into both of the error messages in this thread trying to figure out how to use the default flake output in a normal
ci.nixthat I need tonix-build. I might still be holding it wrong, but I ended up getting it working by just using: