It's not really that straightforward, because `nix-env` is a part of Nix, but `configuration.nix` is a configuration of NixOS. Those are two different projects.
Furthermore, it is not really correct to say that “`nix-env` reads” or “does not read” `configuration.nix`. It reads the expression it was told to read and all the overriding stuff etc. are just internal things of the expression. In the case of `nix-env` without explicit `-f` it basically reads `top-level/all-packages.nix`, and there we have `config` read from `~/.nixpkgs/config.nix` (see the very beginning of `top-level/all-packages.nix`) and then `config.packageOverrides` used to modify the set of all packages. So, I guess, the easiest way to achieve this is to explicitly merge `packageOverrides` in your `~/.nixpkgs/config.nix` with the ones in `configuration.nix`. In case you don’t want this code in `~/.nixpkgs/config.nix` for some reason, you can just make `top-level/all-packages.nix` read the config from another system-wide file (e.g. by setting `$NIXPKGS_CONFIG` or altering `~/.nix-defexpr` and calling `top-level/all-packages.nix` with a custom `config` argument there) and do the importing `~/.nixpkgs/config.nix` and merging in that other system-wide file. In other words, there are many ways, but none of them is good enough to be integrated into upstream nixpkgs, because nixpkgs are supposed to work on non-NixOS and having it check whether `/etc/nixos/configuration.nix` exists and read it in this case feels like a hack to me. On Sun, Feb 22, 2015, 11:33 Bjørn Forsman <bjorn.fors...@gmail.com> wrote: > > 22. feb. 2015 08:29 skrev "Cody Goodman" <codygman.consult...@gmail.com> > følgende: > [...] > > > > For some reason nix can't seem to find it... > > > > ~ $ grep -A3 helloEnv /etc/nixos/configuration.nix > > 53: helloEnv = pkgs.myEnvFun { > > 54- name = "someEnvName"; > > 55- buildInputs = [ hello ]; > > 56- }; > > ~ $ nix-env -i env-someEnvName > > error: selector ‘env-someEnvName’ matches no derivations > > nix-env does not read configuration.nix. If you want that, put your > packageOverrides in ~/.nixpkgs/config.nix instead. > > I've done the same mistake myself. I think it is a bit confusing that > nix-env ignores the system-wide packageOverrides. I think it would be > better if it merged those packageOverrides (if possible). > > - Bjørn > _______________________________________________ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev >
_______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev