r/NixOS•
edstrange

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
Stahlbroetchen•

Run nix-shell or nix-build in the directory with default.nix without arguments.

nix-shell -p avr-binutils looks for a derivation of that name in nixpkgs, but you want it to use your own derivation in default.nix. That is default behavior when called without arguments.

3
ineffective_topos•

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.nix

1
edstrangeOP•

I get error: unrecognised flag '-f'

You were talking about nix-shell right?

1
ineffective_topos•

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 under nixuses-f` for files, and otherwise interprets nix paths.

1
edstrangeOP•

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.

1
[deleted]•

[deleted]

1