Defining shell
in an overlay seems to produce surprising behavior. In the following example
let
overlay = self: super: {
myshell = self.mkShell {
buildInputs = [ self.hello ];
};
};
pkgs = import <nixpkgs> { overlays = [ overlay ]; };
in
pkgs.myshell
nix-shell
works as expected, but when myshell
is renamed to shell
I get the following error trace:
This derivation is not meant to be built, aborting
builder for '/nix/store/92py6nlc2f27b9ddd0wppmlxc16j19d5-nix-shell.drv' failed with exit code 1
cannot build derivation '/nix/store/1v9dw56m8452vhq5gzh7pj2dxrzrsn6l-binutils-wrapper-2.35.1.drv': 1 dependencies couldn't be built
...
I originally discovered this while adding GitHub - cdepillabout/nix-cabal-example-project to my project; nix-shell
works as-is, but when I changed our-shell
to shell
in the overlay (this diff), I get the (confusingly, different) error
error: anonymous function at /nix/store/hz2yzvaihcna6gc54mvs4c0mpwv3yqr1-source/pkgs/build-support/fetchurl/boot.nix:5:1 called with unexpected argument 'postFetch', at /nix/store/hz2yzvaihcna6gc54mvs4c0mpwv3yqr1-source/pkgs/build-support/fetchzip/default.nix:17:2
I’m a bit puzzled because I don’t see an existing shell
attribute in the nixpkgs global namespace, so it doesn’t seem like I’d be clobbering anything. Not using shell
is simple enough, but I’d really like to understand what’s going on here so as to avoid frustrating debugging in the future.