NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.92k stars 1.53k forks source link

Upgrading nix from a custom nix-install selects wrong store-dir and localstatedir #782

Closed knedlsepp closed 8 years ago

knedlsepp commented 8 years ago

I installed nix in a special directory /panfs/panfs.zamg.at/perm/vhmod/jkemet/opt/nix/ instead of /nix. Now that I'm trying to upgrade to nix-1.11 the settings for localstatedir and store-dir are ignored.

I try the following

$ nix-env -i nix-1.11pre4379_786046c

which results in:

....
configure flags: --prefix=/panfs/panfs.zamg.at/perm/vhmod/jkemet/opt/nix/store/q18gxzpjd25hcszsgjvsfcxym76gas7k-nix-1.11pre4379_786046c 
--with-store-dir=/nix/store --localstatedir=/nix/var --sysconfdir=/etc
--with-dbi=/panfs/panfs.zamg.at/perm/vhmod/jkemet/opt/nix/store/bc3v00shzlhlyc6fq28hh0b4ihl2l56z-perl-DBI-1.634/lib/perl5/site_perl
--with-dbd-sqlite=/panfs/panfs.zamg.at/perm/vhmod/jkemet/opt/nix/store/1vhkbap4qdbgsnl19qhpp7x8yb3yy6am-perl-DBD-SQLite-1.48/lib/perl5/site_perl
--with-www-curl=/panfs/panfs.zamg.at/perm/vhmod/jkemet/opt/nix/store/vbd0lpf2kgb4khbp7g3hin98jzy0nwp0-perl-WWW-Curl-4.17/lib/perl5/site_perl
--disable-init-state
--enable-gc
...

Due to the misconfiguration the resulting nix-env shows:

$ nix-env -i cowsay
error: creating directory ‘/nix’: Permission denied

My ~/.nixpkgs/config.nix reads:

 pkgs:
 {
   packageOverrides = self: {
     nix = self.nix.override {
       # Replace $HOME with your actual home directory; it will not
       # be expanded for you.
       # Also, the double quotes around the path are mandatory.
       storeDir = "/panfs/panfs.zamg.at/perm/vhmod/jkemet/opt/nix/store";
       stateDir = "/panfs/panfs.zamg.at/perm/vhmod/jkemet/opt/nix/var";
     };
   };
 }

Why aren't those settings being picked up?

knedlsepp commented 8 years ago

Ok. Got what I was doing wrong. Obviously the attribute name of nix-1.11pre4379_786046c is "nixUnstable". So the correct override would be:

nixUnstable = self.nixUnstable.override {
....