Merge #14953: fix fallout after splitting nix
I rebased this against master to avoid getting staging commits for now.
This commit is contained in:
commit
f9e5eccb13
@ -81,14 +81,14 @@ pkgs.vmTools.runInLinuxVM (
|
|||||||
|
|
||||||
# Register the paths in the Nix database.
|
# Register the paths in the Nix database.
|
||||||
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group ""
|
chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db --option build-users-group ""
|
||||||
|
|
||||||
# Add missing size/hash fields to the database. FIXME:
|
# Add missing size/hash fields to the database. FIXME:
|
||||||
# exportReferencesGraph should provide these directly.
|
# exportReferencesGraph should provide these directly.
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-store --verify --check-contents
|
chroot /mnt ${config.nix.package.out}/bin/nix-store --verify --check-contents
|
||||||
|
|
||||||
# Create the system profile to allow nixos-rebuild to work.
|
# Create the system profile to allow nixos-rebuild to work.
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-env --option build-users-group "" \
|
chroot /mnt ${config.nix.package.out}/bin/nix-env --option build-users-group "" \
|
||||||
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
|
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
|
||||||
|
|
||||||
# `nixos-rebuild' requires an /etc/NIXOS.
|
# `nixos-rebuild' requires an /etc/NIXOS.
|
||||||
|
@ -34,7 +34,7 @@ in
|
|||||||
if ! [ -e /var/lib/nixos/did-channel-init ]; then
|
if ! [ -e /var/lib/nixos/did-channel-init ]; then
|
||||||
echo "unpacking the NixOS/Nixpkgs sources..."
|
echo "unpacking the NixOS/Nixpkgs sources..."
|
||||||
mkdir -p /nix/var/nix/profiles/per-user/root
|
mkdir -p /nix/var/nix/profiles/per-user/root
|
||||||
${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \
|
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \
|
||||||
-i ${channelSources} --quiet --option build-use-substitutes false
|
-i ${channelSources} --quiet --option build-use-substitutes false
|
||||||
mkdir -m 0700 -p /root/.nix-defexpr
|
mkdir -m 0700 -p /root/.nix-defexpr
|
||||||
ln -s /nix/var/nix/profiles/per-user/root/channels /root/.nix-defexpr/channels
|
ln -s /nix/var/nix/profiles/per-user/root/channels /root/.nix-defexpr/channels
|
||||||
|
@ -364,12 +364,12 @@ in
|
|||||||
''
|
''
|
||||||
# After booting, register the contents of the Nix store on the
|
# After booting, register the contents of the Nix store on the
|
||||||
# CD in the Nix database in the tmpfs.
|
# CD in the Nix database in the tmpfs.
|
||||||
${config.nix.package}/bin/nix-store --load-db < /nix/store/nix-path-registration
|
${config.nix.package.out}/bin/nix-store --load-db < /nix/store/nix-path-registration
|
||||||
|
|
||||||
# nixos-rebuild also requires a "system" profile and an
|
# nixos-rebuild also requires a "system" profile and an
|
||||||
# /etc/NIXOS tag.
|
# /etc/NIXOS tag.
|
||||||
touch /etc/NIXOS
|
touch /etc/NIXOS
|
||||||
${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Add vfat support to the initrd to enable people to copy the
|
# Add vfat support to the initrd to enable people to copy the
|
||||||
|
@ -113,11 +113,11 @@ in
|
|||||||
${pkgs.e2fsprogs}/bin/resize2fs $rootPart
|
${pkgs.e2fsprogs}/bin/resize2fs $rootPart
|
||||||
|
|
||||||
# Register the contents of the initial Nix store
|
# Register the contents of the initial Nix store
|
||||||
${config.nix.package}/bin/nix-store --load-db < /nix-path-registration
|
${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration
|
||||||
|
|
||||||
# nixos-rebuild also requires a "system" profile and an /etc/NIXOS tag.
|
# nixos-rebuild also requires a "system" profile and an /etc/NIXOS tag.
|
||||||
touch /etc/NIXOS
|
touch /etc/NIXOS
|
||||||
${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||||
|
|
||||||
# Prevents this from running on later boots.
|
# Prevents this from running on later boots.
|
||||||
rm -f /nix-path-registration
|
rm -f /nix-path-registration
|
||||||
|
@ -78,14 +78,14 @@ in
|
|||||||
# After booting, register the contents of the Nix store on the
|
# After booting, register the contents of the Nix store on the
|
||||||
# CD in the Nix database in the tmpfs.
|
# CD in the Nix database in the tmpfs.
|
||||||
if [ -f /nix-path-registration ]; then
|
if [ -f /nix-path-registration ]; then
|
||||||
${config.nix.package}/bin/nix-store --load-db < /nix-path-registration &&
|
${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration &&
|
||||||
rm /nix-path-registration
|
rm /nix-path-registration
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# nixos-rebuild also requires a "system" profile and an
|
# nixos-rebuild also requires a "system" profile and an
|
||||||
# /etc/NIXOS tag.
|
# /etc/NIXOS tag.
|
||||||
touch /etc/NIXOS
|
touch /etc/NIXOS
|
||||||
${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -78,7 +78,7 @@ let cfg = config.system.autoUpgrade; in
|
|||||||
HOME = "/root";
|
HOME = "/root";
|
||||||
};
|
};
|
||||||
|
|
||||||
path = [ pkgs.gnutar pkgs.xz.bin config.nix.package ];
|
path = [ pkgs.gnutar pkgs.xz.bin config.nix.package.out ];
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
${config.system.build.nixos-rebuild}/bin/nixos-rebuild switch ${toString cfg.flags}
|
${config.system.build.nixos-rebuild}/bin/nixos-rebuild switch ${toString cfg.flags}
|
||||||
|
@ -271,7 +271,7 @@ remotePATH=
|
|||||||
if [ -n "$buildNix" ]; then
|
if [ -n "$buildNix" ]; then
|
||||||
echo "building Nix..." >&2
|
echo "building Nix..." >&2
|
||||||
nixDrv=
|
nixDrv=
|
||||||
if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A config.nix.package "${extraBuildFlags[@]}")"; then
|
if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A config.nix.package.out "${extraBuildFlags[@]}")"; then
|
||||||
if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A nixFallback "${extraBuildFlags[@]}")"; then
|
if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A nixFallback "${extraBuildFlags[@]}")"; then
|
||||||
if ! nixDrv="$(nix-instantiate '<nixpkgs>' --add-root $tmpDir/nix.drv --indirect -A nix "${extraBuildFlags[@]}")"; then
|
if ! nixDrv="$(nix-instantiate '<nixpkgs>' --add-root $tmpDir/nix.drv --indirect -A nix "${extraBuildFlags[@]}")"; then
|
||||||
nixStorePath="$(prebuiltNix "$(uname -m)")"
|
nixStorePath="$(prebuiltNix "$(uname -m)")"
|
||||||
|
@ -22,17 +22,17 @@ let
|
|||||||
src = ./nixos-install.sh;
|
src = ./nixos-install.sh;
|
||||||
|
|
||||||
inherit (pkgs) perl pathsFromGraph;
|
inherit (pkgs) perl pathsFromGraph;
|
||||||
nix = config.nix.package;
|
nix = config.nix.package.out;
|
||||||
|
|
||||||
nixClosure = pkgs.runCommand "closure"
|
nixClosure = pkgs.runCommand "closure"
|
||||||
{ exportReferencesGraph = ["refs" config.nix.package]; }
|
{ exportReferencesGraph = ["refs" config.nix.package.out]; }
|
||||||
"cp refs $out";
|
"cp refs $out";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos-rebuild = makeProg {
|
nixos-rebuild = makeProg {
|
||||||
name = "nixos-rebuild";
|
name = "nixos-rebuild";
|
||||||
src = ./nixos-rebuild.sh;
|
src = ./nixos-rebuild.sh;
|
||||||
nix = config.nix.package;
|
nix = config.nix.package.out;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos-generate-config = makeProg {
|
nixos-generate-config = makeProg {
|
||||||
|
@ -37,12 +37,12 @@ in {
|
|||||||
# After booting, register the contents of the Nix store in the Nix
|
# After booting, register the contents of the Nix store in the Nix
|
||||||
# database.
|
# database.
|
||||||
if [ -f /nix-path-registration ]; then
|
if [ -f /nix-path-registration ]; then
|
||||||
${config.nix.package}/bin/nix-store --load-db < /nix-path-registration &&
|
${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration &&
|
||||||
rm /nix-path-registration
|
rm /nix-path-registration
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# nixos-rebuild also requires a "system" profile
|
# nixos-rebuild also requires a "system" profile
|
||||||
${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Install new init script
|
# Install new init script
|
||||||
|
@ -6,7 +6,7 @@ let
|
|||||||
|
|
||||||
cfg = config.nix;
|
cfg = config.nix;
|
||||||
|
|
||||||
nix = cfg.package;
|
nix = cfg.package.out;
|
||||||
|
|
||||||
makeNixBuildUser = nr:
|
makeNixBuildUser = nr:
|
||||||
{ name = "nixbld${toString nr}";
|
{ name = "nixbld${toString nr}";
|
||||||
@ -65,8 +65,8 @@ in
|
|||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.nix.out;
|
default = pkgs.nix;
|
||||||
defaultText = "pkgs.nix.out";
|
defaultText = "pkgs.nix";
|
||||||
description = ''
|
description = ''
|
||||||
This option specifies the Nix package instance to use throughout the system.
|
This option specifies the Nix package instance to use throughout the system.
|
||||||
'';
|
'';
|
||||||
|
@ -52,7 +52,7 @@ in
|
|||||||
|
|
||||||
systemd.services.nix-gc =
|
systemd.services.nix-gc =
|
||||||
{ description = "Nix Garbage Collector";
|
{ description = "Nix Garbage Collector";
|
||||||
script = "exec ${config.nix.package}/bin/nix-collect-garbage ${cfg.options}";
|
script = "exec ${config.nix.package.out}/bin/nix-collect-garbage ${cfg.options}";
|
||||||
startAt = optionalString cfg.automatic cfg.dates;
|
startAt = optionalString cfg.automatic cfg.dates;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ with lib;
|
|||||||
PermitTTY no
|
PermitTTY no
|
||||||
PermitTunnel no
|
PermitTunnel no
|
||||||
X11Forwarding no
|
X11Forwarding no
|
||||||
ForceCommand ${config.nix.package}/bin/nix-store --serve
|
ForceCommand ${config.nix.package.out}/bin/nix-store --serve
|
||||||
Match All
|
Match All
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ in
|
|||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
path = [ config.nix.package pkgs.bzip2.bin ];
|
path = [ config.nix.package.out pkgs.bzip2.bin ];
|
||||||
environment.NIX_REMOTE = "daemon";
|
environment.NIX_REMOTE = "daemon";
|
||||||
environment.NIX_SECRET_KEY_FILE = cfg.secretKeyFile;
|
environment.NIX_SECRET_KEY_FILE = cfg.secretKeyFile;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ let
|
|||||||
|
|
||||||
inherit (pkgs) python gummiboot;
|
inherit (pkgs) python gummiboot;
|
||||||
|
|
||||||
nix = config.nix.package;
|
nix = config.nix.package.out;
|
||||||
|
|
||||||
timeout = if cfg.timeout != null then cfg.timeout else "";
|
timeout = if cfg.timeout != null then cfg.timeout else "";
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ let
|
|||||||
|
|
||||||
echo "attempting to fetch configuration from EC2 user data..."
|
echo "attempting to fetch configuration from EC2 user data..."
|
||||||
|
|
||||||
export PATH=${config.nix.package}/bin:${pkgs.systemd}/bin:${pkgs.gnugrep}/bin:${pkgs.gnused}/bin:${config.system.build.nixos-rebuild}/bin:$PATH
|
export PATH=${pkgs.lib.makeBinPath [ config.nix.package pkgs.systemd pkgs.gnugrep pkgs.gnused config.system.build.nixos-rebuild]}:$PATH
|
||||||
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
|
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
|
||||||
|
|
||||||
userData=/etc/ec2-metadata/user-data
|
userData=/etc/ec2-metadata/user-data
|
||||||
|
@ -62,10 +62,10 @@ in
|
|||||||
|
|
||||||
echo Register the paths in the Nix database.
|
echo Register the paths in the Nix database.
|
||||||
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group ""
|
chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db --option build-users-group ""
|
||||||
|
|
||||||
echo Create the system profile to allow nixos-rebuild to work.
|
echo Create the system profile to allow nixos-rebuild to work.
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-env \
|
chroot /mnt ${config.nix.package.out}/bin/nix-env \
|
||||||
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} --option build-users-group ""
|
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} --option build-users-group ""
|
||||||
|
|
||||||
echo nixos-rebuild requires an /etc/NIXOS.
|
echo nixos-rebuild requires an /etc/NIXOS.
|
||||||
|
@ -62,10 +62,10 @@ in
|
|||||||
|
|
||||||
# Register the paths in the Nix database.
|
# Register the paths in the Nix database.
|
||||||
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group ""
|
chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db --option build-users-group ""
|
||||||
|
|
||||||
# Create the system profile to allow nixos-rebuild to work.
|
# Create the system profile to allow nixos-rebuild to work.
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-env \
|
chroot /mnt ${config.nix.package.out}/bin/nix-env \
|
||||||
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} \
|
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} \
|
||||||
--option build-users-group ""
|
--option build-users-group ""
|
||||||
|
|
||||||
|
@ -66,10 +66,10 @@ in
|
|||||||
|
|
||||||
# Register the paths in the Nix database.
|
# Register the paths in the Nix database.
|
||||||
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group ""
|
chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db --option build-users-group ""
|
||||||
|
|
||||||
# Create the system profile to allow nixos-rebuild to work.
|
# Create the system profile to allow nixos-rebuild to work.
|
||||||
chroot /mnt ${config.nix.package}/bin/nix-env \
|
chroot /mnt ${config.nix.package.out}/bin/nix-env \
|
||||||
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} \
|
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} \
|
||||||
--option build-users-group ""
|
--option build-users-group ""
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ in
|
|||||||
boot.postBootCommands =
|
boot.postBootCommands =
|
||||||
''
|
''
|
||||||
if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then
|
if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then
|
||||||
${config.nix.package}/bin/nix-store --load-db < ''${BASH_REMATCH[1]}
|
${config.nix.package.out}/bin/nix-store --load-db < ''${BASH_REMATCH[1]}
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user