Merge #14953: fix fallout after splitting nix

I rebased this against master to avoid getting staging commits for now.

+32 -32
+3 -3
nixos/lib/make-disk-image.nix
··· 81 82 # Register the paths in the Nix database. 83 printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ 84 - chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group "" 85 86 # Add missing size/hash fields to the database. FIXME: 87 # exportReferencesGraph should provide these directly. 88 - chroot /mnt ${config.nix.package}/bin/nix-store --verify --check-contents 89 90 # Create the system profile to allow nixos-rebuild to work. 91 - chroot /mnt ${config.nix.package}/bin/nix-env --option build-users-group "" \ 92 -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} 93 94 # `nixos-rebuild' requires an /etc/NIXOS.
··· 81 82 # Register the paths in the Nix database. 83 printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ 84 + chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db --option build-users-group "" 85 86 # Add missing size/hash fields to the database. FIXME: 87 # exportReferencesGraph should provide these directly. 88 + chroot /mnt ${config.nix.package.out}/bin/nix-store --verify --check-contents 89 90 # Create the system profile to allow nixos-rebuild to work. 91 + chroot /mnt ${config.nix.package.out}/bin/nix-env --option build-users-group "" \ 92 -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} 93 94 # `nixos-rebuild' requires an /etc/NIXOS.
+1 -1
nixos/modules/installer/cd-dvd/channel.nix
··· 34 if ! [ -e /var/lib/nixos/did-channel-init ]; then 35 echo "unpacking the NixOS/Nixpkgs sources..." 36 mkdir -p /nix/var/nix/profiles/per-user/root 37 - ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \ 38 -i ${channelSources} --quiet --option build-use-substitutes false 39 mkdir -m 0700 -p /root/.nix-defexpr 40 ln -s /nix/var/nix/profiles/per-user/root/channels /root/.nix-defexpr/channels
··· 34 if ! [ -e /var/lib/nixos/did-channel-init ]; then 35 echo "unpacking the NixOS/Nixpkgs sources..." 36 mkdir -p /nix/var/nix/profiles/per-user/root 37 + ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \ 38 -i ${channelSources} --quiet --option build-use-substitutes false 39 mkdir -m 0700 -p /root/.nix-defexpr 40 ln -s /nix/var/nix/profiles/per-user/root/channels /root/.nix-defexpr/channels
+2 -2
nixos/modules/installer/cd-dvd/iso-image.nix
··· 364 '' 365 # After booting, register the contents of the Nix store on the 366 # CD in the Nix database in the tmpfs. 367 - ${config.nix.package}/bin/nix-store --load-db < /nix/store/nix-path-registration 368 369 # nixos-rebuild also requires a "system" profile and an 370 # /etc/NIXOS tag. 371 touch /etc/NIXOS 372 - ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 373 ''; 374 375 # Add vfat support to the initrd to enable people to copy the
··· 364 '' 365 # After booting, register the contents of the Nix store on the 366 # CD in the Nix database in the tmpfs. 367 + ${config.nix.package.out}/bin/nix-store --load-db < /nix/store/nix-path-registration 368 369 # nixos-rebuild also requires a "system" profile and an 370 # /etc/NIXOS tag. 371 touch /etc/NIXOS 372 + ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 373 ''; 374 375 # Add vfat support to the initrd to enable people to copy the
+2 -2
nixos/modules/installer/cd-dvd/sd-image.nix
··· 113 ${pkgs.e2fsprogs}/bin/resize2fs $rootPart 114 115 # Register the contents of the initial Nix store 116 - ${config.nix.package}/bin/nix-store --load-db < /nix-path-registration 117 118 # nixos-rebuild also requires a "system" profile and an /etc/NIXOS tag. 119 touch /etc/NIXOS 120 - ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 121 122 # Prevents this from running on later boots. 123 rm -f /nix-path-registration
··· 113 ${pkgs.e2fsprogs}/bin/resize2fs $rootPart 114 115 # Register the contents of the initial Nix store 116 + ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration 117 118 # nixos-rebuild also requires a "system" profile and an /etc/NIXOS tag. 119 touch /etc/NIXOS 120 + ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 121 122 # Prevents this from running on later boots. 123 rm -f /nix-path-registration
+2 -2
nixos/modules/installer/cd-dvd/system-tarball.nix
··· 78 # After booting, register the contents of the Nix store on the 79 # CD in the Nix database in the tmpfs. 80 if [ -f /nix-path-registration ]; then 81 - ${config.nix.package}/bin/nix-store --load-db < /nix-path-registration && 82 rm /nix-path-registration 83 fi 84 85 # nixos-rebuild also requires a "system" profile and an 86 # /etc/NIXOS tag. 87 touch /etc/NIXOS 88 - ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 89 ''; 90 91 };
··· 78 # After booting, register the contents of the Nix store on the 79 # CD in the Nix database in the tmpfs. 80 if [ -f /nix-path-registration ]; then 81 + ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration && 82 rm /nix-path-registration 83 fi 84 85 # nixos-rebuild also requires a "system" profile and an 86 # /etc/NIXOS tag. 87 touch /etc/NIXOS 88 + ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 89 ''; 90 91 };
+1 -1
nixos/modules/installer/tools/auto-upgrade.nix
··· 78 HOME = "/root"; 79 }; 80 81 - path = [ pkgs.gnutar pkgs.xz.bin config.nix.package ]; 82 83 script = '' 84 ${config.system.build.nixos-rebuild}/bin/nixos-rebuild switch ${toString cfg.flags}
··· 78 HOME = "/root"; 79 }; 80 81 + path = [ pkgs.gnutar pkgs.xz.bin config.nix.package.out ]; 82 83 script = '' 84 ${config.system.build.nixos-rebuild}/bin/nixos-rebuild switch ${toString cfg.flags}
+1 -1
nixos/modules/installer/tools/nixos-rebuild.sh
··· 271 if [ -n "$buildNix" ]; then 272 echo "building Nix..." >&2 273 nixDrv= 274 - if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A config.nix.package "${extraBuildFlags[@]}")"; then 275 if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A nixFallback "${extraBuildFlags[@]}")"; then 276 if ! nixDrv="$(nix-instantiate '<nixpkgs>' --add-root $tmpDir/nix.drv --indirect -A nix "${extraBuildFlags[@]}")"; then 277 nixStorePath="$(prebuiltNix "$(uname -m)")"
··· 271 if [ -n "$buildNix" ]; then 272 echo "building Nix..." >&2 273 nixDrv= 274 + if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A config.nix.package.out "${extraBuildFlags[@]}")"; then 275 if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A nixFallback "${extraBuildFlags[@]}")"; then 276 if ! nixDrv="$(nix-instantiate '<nixpkgs>' --add-root $tmpDir/nix.drv --indirect -A nix "${extraBuildFlags[@]}")"; then 277 nixStorePath="$(prebuiltNix "$(uname -m)")"
+3 -3
nixos/modules/installer/tools/tools.nix
··· 22 src = ./nixos-install.sh; 23 24 inherit (pkgs) perl pathsFromGraph; 25 - nix = config.nix.package; 26 27 nixClosure = pkgs.runCommand "closure" 28 - { exportReferencesGraph = ["refs" config.nix.package]; } 29 "cp refs $out"; 30 }; 31 32 nixos-rebuild = makeProg { 33 name = "nixos-rebuild"; 34 src = ./nixos-rebuild.sh; 35 - nix = config.nix.package; 36 }; 37 38 nixos-generate-config = makeProg {
··· 22 src = ./nixos-install.sh; 23 24 inherit (pkgs) perl pathsFromGraph; 25 + nix = config.nix.package.out; 26 27 nixClosure = pkgs.runCommand "closure" 28 + { exportReferencesGraph = ["refs" config.nix.package.out]; } 29 "cp refs $out"; 30 }; 31 32 nixos-rebuild = makeProg { 33 name = "nixos-rebuild"; 34 src = ./nixos-rebuild.sh; 35 + nix = config.nix.package.out; 36 }; 37 38 nixos-generate-config = makeProg {
+2 -2
nixos/modules/profiles/docker-container.nix
··· 37 # After booting, register the contents of the Nix store in the Nix 38 # database. 39 if [ -f /nix-path-registration ]; then 40 - ${config.nix.package}/bin/nix-store --load-db < /nix-path-registration && 41 rm /nix-path-registration 42 fi 43 44 # nixos-rebuild also requires a "system" profile 45 - ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 46 ''; 47 48 # Install new init script
··· 37 # After booting, register the contents of the Nix store in the Nix 38 # database. 39 if [ -f /nix-path-registration ]; then 40 + ${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration && 41 rm /nix-path-registration 42 fi 43 44 # nixos-rebuild also requires a "system" profile 45 + ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system 46 ''; 47 48 # Install new init script
+3 -3
nixos/modules/services/misc/nix-daemon.nix
··· 6 7 cfg = config.nix; 8 9 - nix = cfg.package; 10 11 makeNixBuildUser = nr: 12 { name = "nixbld${toString nr}"; ··· 65 66 package = mkOption { 67 type = types.package; 68 - default = pkgs.nix.out; 69 - defaultText = "pkgs.nix.out"; 70 description = '' 71 This option specifies the Nix package instance to use throughout the system. 72 '';
··· 6 7 cfg = config.nix; 8 9 + nix = cfg.package.out; 10 11 makeNixBuildUser = nr: 12 { name = "nixbld${toString nr}"; ··· 65 66 package = mkOption { 67 type = types.package; 68 + default = pkgs.nix; 69 + defaultText = "pkgs.nix"; 70 description = '' 71 This option specifies the Nix package instance to use throughout the system. 72 '';
+1 -1
nixos/modules/services/misc/nix-gc.nix
··· 52 53 systemd.services.nix-gc = 54 { description = "Nix Garbage Collector"; 55 - script = "exec ${config.nix.package}/bin/nix-collect-garbage ${cfg.options}"; 56 startAt = optionalString cfg.automatic cfg.dates; 57 }; 58
··· 52 53 systemd.services.nix-gc = 54 { description = "Nix Garbage Collector"; 55 + script = "exec ${config.nix.package.out}/bin/nix-collect-garbage ${cfg.options}"; 56 startAt = optionalString cfg.automatic cfg.dates; 57 }; 58
+1 -1
nixos/modules/services/misc/nix-ssh-serve.nix
··· 41 PermitTTY no 42 PermitTunnel no 43 X11Forwarding no 44 - ForceCommand ${config.nix.package}/bin/nix-store --serve 45 Match All 46 ''; 47
··· 41 PermitTTY no 42 PermitTunnel no 43 X11Forwarding no 44 + ForceCommand ${config.nix.package.out}/bin/nix-store --serve 45 Match All 46 ''; 47
+1 -1
nixos/modules/services/networking/nix-serve.nix
··· 50 after = [ "network.target" ]; 51 wantedBy = [ "multi-user.target" ]; 52 53 - path = [ config.nix.package pkgs.bzip2.bin ]; 54 environment.NIX_REMOTE = "daemon"; 55 environment.NIX_SECRET_KEY_FILE = cfg.secretKeyFile; 56
··· 50 after = [ "network.target" ]; 51 wantedBy = [ "multi-user.target" ]; 52 53 + path = [ config.nix.package.out pkgs.bzip2.bin ]; 54 environment.NIX_REMOTE = "daemon"; 55 environment.NIX_SECRET_KEY_FILE = cfg.secretKeyFile; 56
+1 -1
nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
··· 14 15 inherit (pkgs) python gummiboot; 16 17 - nix = config.nix.package; 18 19 timeout = if cfg.timeout != null then cfg.timeout else ""; 20
··· 14 15 inherit (pkgs) python gummiboot; 16 17 + nix = config.nix.package.out; 18 19 timeout = if cfg.timeout != null then cfg.timeout else ""; 20
+1 -1
nixos/modules/virtualisation/amazon-init.nix
··· 8 9 echo "attempting to fetch configuration from EC2 user data..." 10 11 - export PATH=${config.nix.package}/bin:${pkgs.systemd}/bin:${pkgs.gnugrep}/bin:${pkgs.gnused}/bin:${config.system.build.nixos-rebuild}/bin:$PATH 12 export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels 13 14 userData=/etc/ec2-metadata/user-data
··· 8 9 echo "attempting to fetch configuration from EC2 user data..." 10 11 + export PATH=${pkgs.lib.makeBinPath [ config.nix.package pkgs.systemd pkgs.gnugrep pkgs.gnused config.system.build.nixos-rebuild]}:$PATH 12 export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels 13 14 userData=/etc/ec2-metadata/user-data
+2 -2
nixos/modules/virtualisation/azure-image.nix
··· 62 63 echo Register the paths in the Nix database. 64 printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ 65 - chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group "" 66 67 echo Create the system profile to allow nixos-rebuild to work. 68 - chroot /mnt ${config.nix.package}/bin/nix-env \ 69 -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} --option build-users-group "" 70 71 echo nixos-rebuild requires an /etc/NIXOS.
··· 62 63 echo Register the paths in the Nix database. 64 printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ 65 + chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db --option build-users-group "" 66 67 echo Create the system profile to allow nixos-rebuild to work. 68 + chroot /mnt ${config.nix.package.out}/bin/nix-env \ 69 -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} --option build-users-group "" 70 71 echo nixos-rebuild requires an /etc/NIXOS.
+2 -2
nixos/modules/virtualisation/brightbox-image.nix
··· 62 63 # Register the paths in the Nix database. 64 printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ 65 - chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group "" 66 67 # Create the system profile to allow nixos-rebuild to work. 68 - chroot /mnt ${config.nix.package}/bin/nix-env \ 69 -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} \ 70 --option build-users-group "" 71
··· 62 63 # Register the paths in the Nix database. 64 printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ 65 + chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db --option build-users-group "" 66 67 # Create the system profile to allow nixos-rebuild to work. 68 + chroot /mnt ${config.nix.package.out}/bin/nix-env \ 69 -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} \ 70 --option build-users-group "" 71
+2 -2
nixos/modules/virtualisation/google-compute-image.nix
··· 66 67 # Register the paths in the Nix database. 68 printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ 69 - chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group "" 70 71 # Create the system profile to allow nixos-rebuild to work. 72 - chroot /mnt ${config.nix.package}/bin/nix-env \ 73 -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} \ 74 --option build-users-group "" 75
··· 66 67 # Register the paths in the Nix database. 68 printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ 69 + chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db --option build-users-group "" 70 71 # Create the system profile to allow nixos-rebuild to work. 72 + chroot /mnt ${config.nix.package.out}/bin/nix-env \ 73 -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} \ 74 --option build-users-group "" 75
+1 -1
nixos/modules/virtualisation/qemu-vm.nix
··· 403 boot.postBootCommands = 404 '' 405 if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then 406 - ${config.nix.package}/bin/nix-store --load-db < ''${BASH_REMATCH[1]} 407 fi 408 ''; 409
··· 403 boot.postBootCommands = 404 '' 405 if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then 406 + ${config.nix.package.out}/bin/nix-store --load-db < ''${BASH_REMATCH[1]} 407 fi 408 ''; 409