diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2014-06-30 12:47:17 +0400 |
---|---|---|
committer | Michael Raskin <7c6f434c@mail.ru> | 2014-06-30 12:47:17 +0400 |
commit | 77314b7eb22487c1b2f0cb925e9aab056fd3a206 (patch) | |
tree | 9c41bcebbdb321b28aba40457563cfcb35dbf49b /nixos | |
parent | d61129a117b6c4178f0e2b27d6e7eca157446dda (diff) | |
parent | 068c7fd037981a7746e627fe4a29c7a4ce034948 (diff) | |
download | nixpkgs-77314b7eb22487c1b2f0cb925e9aab056fd3a206.tar nixpkgs-77314b7eb22487c1b2f0cb925e9aab056fd3a206.tar.gz nixpkgs-77314b7eb22487c1b2f0cb925e9aab056fd3a206.tar.bz2 nixpkgs-77314b7eb22487c1b2f0cb925e9aab056fd3a206.tar.lz nixpkgs-77314b7eb22487c1b2f0cb925e9aab056fd3a206.tar.xz nixpkgs-77314b7eb22487c1b2f0cb925e9aab056fd3a206.tar.zst nixpkgs-77314b7eb22487c1b2f0cb925e9aab056fd3a206.zip |
Merge pull request #2888 from nilcons/no-random-arch-downgrades
Fix nixos-rebuild.sh to depend on Nix
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/installer/tools/nixos-rebuild.sh | 10 | ||||
-rw-r--r-- | nixos/modules/installer/tools/tools.nix | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index d7b749573fa..be37e61151a 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -97,6 +97,16 @@ if [ -n "$upgrade" -a -z "$_NIXOS_REBUILD_REEXEC" ]; then nix-channel --update nixos fi +# Make sure that we use the Nix package we depend on, not something +# else from the PATH for nix-{env,instantiate,build}. This is +# important, because NixOS defaults the architecture of the rebuilt +# system to the architecture of the nix-* binaries used. So if on an +# amd64 system the user has an i686 Nix package in her PATH, then we +# would silently downgrade the whole system to be i686 NixOS on the +# next reboot. +if [ -z "$_NIXOS_REBUILD_REEXEC" ]; then + export PATH=@nix@/bin:$PATH +fi # Re-execute nixos-rebuild from the Nixpkgs tree. if [ -z "$_NIXOS_REBUILD_REEXEC" -a -n "$canRun" ]; then diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 5ebf05e340f..f7fac75eb06 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -32,6 +32,7 @@ let nixos-rebuild = makeProg { name = "nixos-rebuild"; src = ./nixos-rebuild.sh; + nix = config.nix.package; }; nixos-generate-config = makeProg { |