-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
As someone who switches between nix2 and nix3 commands often, I was annoyed when nix build .#geballs (a package that I had just written for nixpkgs and run in the nixpkgs root on my pc) didn't work but nix-build -A geballs did. The nix3 command didn't tell me that the working tree was dirty, because obviously git didn't know about it until I had staged it, so I kept getting the errors
error: flake 'git+file:///home/dre/Projects/nixpkgs' does not provide attribute 'packages.x86_64-linux.geball', 'legacyPackages.x86_64-linux.geball' or 'geball
It would be nice if there was a simple hint message along the lines of hint: did you stage your files? that always printed. I think that though this is semi-ugly to always display this everytime a flake doesn't find an attribute, I think that this is a nice stopgap until things like #6858 and #9352 get resolved. I think it'd be helpful for both beginners and people like me who forget.
It seems that all that would need to be done is add a string to here.
nix/src/libcmd/installable-flake.cc
Lines 192 to 197 in 50cb14f
| if (res.size() == 0) | |
| throw Error( | |
| suggestions, | |
| "flake '%s' does not provide attribute %s", | |
| flakeRef, | |
| showAttrPaths(attrPaths)); |
This isn't a new suggestion by any means, but I think that it would be helpful if this got its own issue so discussion specific to just the tooltip can happen.
Priorities
Add 👍 to issues you find important.