How do I use a package I just built?
So I build this: https://gitlab.com/strange-crew/strange-embedded/arduino/nix-avr/blob/master/binutils/default.nix
And I try to run it but I get these errors:
crazy-eddie@chaos-pit:~/environments/strange-crew/nix-avr/binutils$ nix-shell -p avr-binutils
error: undefined variable 'avr-binutils' at (string):1:94
(use '--show-trace' to show detailed location information)
crazy-eddie@chaos-pit:~/environments/strange-crew/nix-avr/binutils$ nix-env -q avr-binutils
error: selector 'avr-binutils' matches no derivations
What am I missing here? I expected that to work.
Thanks.
Posted Aug 31, 2019, 10:48 PM UTC
15
Run
nix-shellornix-buildin the directory withdefault.nixwithout arguments.nix-shell -p avr-binutilslooks for a derivation of that name in nixpkgs, but you want it to use your own derivation indefault.nix. That is default behavior when called without arguments.Alternatively, use the -f flag to pick a filepath. E.g. you can use
-f avr-binutils. If it ends with default.nix you don't need anything else. For shell.nix you have to use-f avr-binutils/shell.nixI get
error: unrecognised flag '-f'You were talking about
nix-shellright?Oh, huh I made a mistake there. Old-style commands (including nix-shell) can just take a filepath outright. So it's just
nix-shell avr-binutils/shell.nix'. All new-style commands, e.g. anything undernixuses-f` for files, and otherwise interprets nix paths.I was looking into this last night and tried that. However, it only loads the build environment for the package, not the package itself. So I don't have an `avr-ld` in my path after running nix-shell without the arguments. Is there an additional step I am missing? I can nix-build just fine and the result link has my binaries.
I literally just installed also. I should have the latest and greatest unless they released again in this week.
[deleted]