nixos: add system.boot.loader.initrdFile option and use it where appropriate
This commit is contained in:
parent
ecf4825f32
commit
e1782e342f
|
@ -40,30 +40,30 @@ let
|
||||||
|
|
||||||
LABEL boot
|
LABEL boot
|
||||||
MENU LABEL NixOS ${config.system.nixosLabel}${config.isoImage.appendToMenuLabel}
|
MENU LABEL NixOS ${config.system.nixosLabel}${config.isoImage.appendToMenuLabel}
|
||||||
LINUX /boot/bzImage
|
LINUX /boot/${config.system.boot.loader.kernelFile}
|
||||||
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
|
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
|
||||||
INITRD /boot/initrd
|
INITRD /boot/${config.system.boot.loader.initrdFile}
|
||||||
|
|
||||||
# A variant to boot with 'nomodeset'
|
# A variant to boot with 'nomodeset'
|
||||||
LABEL boot-nomodeset
|
LABEL boot-nomodeset
|
||||||
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (nomodeset)
|
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (nomodeset)
|
||||||
LINUX /boot/bzImage
|
LINUX /boot/${config.system.boot.loader.kernelFile}
|
||||||
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
|
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
|
||||||
INITRD /boot/initrd
|
INITRD /boot/${config.system.boot.loader.initrdFile}
|
||||||
|
|
||||||
# A variant to boot with 'copytoram'
|
# A variant to boot with 'copytoram'
|
||||||
LABEL boot-copytoram
|
LABEL boot-copytoram
|
||||||
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (copytoram)
|
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (copytoram)
|
||||||
LINUX /boot/bzImage
|
LINUX /boot/${config.system.boot.loader.kernelFile}
|
||||||
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
|
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
|
||||||
INITRD /boot/initrd
|
INITRD /boot/${config.system.boot.loader.initrdFile}
|
||||||
|
|
||||||
# A variant to boot with verbose logging to the console
|
# A variant to boot with verbose logging to the console
|
||||||
LABEL boot-nomodeset
|
LABEL boot-nomodeset
|
||||||
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (debug)
|
MENU LABEL NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (debug)
|
||||||
LINUX /boot/bzImage
|
LINUX /boot/${config.system.boot.loader.kernelFile}
|
||||||
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
|
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
|
||||||
INITRD /boot/initrd
|
INITRD /boot/${config.system.boot.loader.initrdFile}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
isolinuxMemtest86Entry = ''
|
isolinuxMemtest86Entry = ''
|
||||||
|
@ -83,8 +83,8 @@ let
|
||||||
|
|
||||||
cat << EOF > $out/loader/entries/nixos-iso.conf
|
cat << EOF > $out/loader/entries/nixos-iso.conf
|
||||||
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel}
|
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel}
|
||||||
linux /boot/bzImage
|
linux /boot/${config.system.boot.loader.kernelFile}
|
||||||
initrd /boot/initrd
|
initrd /boot/${config.system.boot.loader.initrdFile}
|
||||||
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
|
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ let
|
||||||
cat << EOF > $out/loader/entries/nixos-iso-nomodeset.conf
|
cat << EOF > $out/loader/entries/nixos-iso-nomodeset.conf
|
||||||
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel}
|
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel}
|
||||||
version nomodeset
|
version nomodeset
|
||||||
linux /boot/bzImage
|
linux /boot/${config.system.boot.loader.kernelFile}
|
||||||
initrd /boot/initrd
|
initrd /boot/${config.system.boot.loader.initrdFile}
|
||||||
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
|
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -101,16 +101,16 @@ let
|
||||||
cat << EOF > $out/loader/entries/nixos-iso-copytoram.conf
|
cat << EOF > $out/loader/entries/nixos-iso-copytoram.conf
|
||||||
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel}
|
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel}
|
||||||
version copytoram
|
version copytoram
|
||||||
linux /boot/bzImage
|
linux /boot/${config.system.boot.loader.kernelFile}
|
||||||
initrd /boot/initrd
|
initrd /boot/${config.system.boot.loader.initrdFile}
|
||||||
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
|
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# A variant to boot with verbose logging to the console
|
# A variant to boot with verbose logging to the console
|
||||||
cat << EOF > $out/loader/entries/nixos-iso-debug.conf
|
cat << EOF > $out/loader/entries/nixos-iso-debug.conf
|
||||||
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (debug)
|
title NixOS ${config.system.nixosVersion}${config.isoImage.appendToMenuLabel} (debug)
|
||||||
linux /boot/bzImage
|
linux /boot/${config.system.boot.loader.kernelFile}
|
||||||
initrd /boot/initrd
|
initrd /boot/${config.system.boot.loader.initrdFile}
|
||||||
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
|
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ let
|
||||||
mkdir ./contents && cd ./contents
|
mkdir ./contents && cd ./contents
|
||||||
cp -rp "${efiDir}"/* .
|
cp -rp "${efiDir}"/* .
|
||||||
mkdir ./boot
|
mkdir ./boot
|
||||||
cp -p "${config.boot.kernelPackages.kernel}/bzImage" \
|
cp -p "${config.boot.kernelPackages.kernel}/${config.system.boot.loader.kernelFile}" \
|
||||||
"${config.system.build.initialRamdisk}/initrd" ./boot/
|
"${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}" ./boot/
|
||||||
touch --date=@0 ./*
|
touch --date=@0 ./*
|
||||||
|
|
||||||
usage_size=$(du -sb --apparent-size . | tr -cd '[:digit:]')
|
usage_size=$(du -sb --apparent-size . | tr -cd '[:digit:]')
|
||||||
|
@ -346,11 +346,11 @@ in
|
||||||
};
|
};
|
||||||
target = "/isolinux/isolinux.cfg";
|
target = "/isolinux/isolinux.cfg";
|
||||||
}
|
}
|
||||||
{ source = config.boot.kernelPackages.kernel + "/bzImage";
|
{ source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile;
|
||||||
target = "/boot/bzImage";
|
target = "/boot/" + config.system.boot.loader.kernelFile;
|
||||||
}
|
}
|
||||||
{ source = config.system.build.initialRamdisk + "/initrd";
|
{ source = config.system.build.initialRamdisk + "/" + config.system.boot.loader.initrdFile;
|
||||||
target = "/boot/initrd";
|
target = "/boot/" + config.system.boot.loader.initrdFile;
|
||||||
}
|
}
|
||||||
{ source = config.system.build.squashfsStore;
|
{ source = config.system.build.squashfsStore;
|
||||||
target = "/nix-store.squashfs";
|
target = "/nix-store.squashfs";
|
||||||
|
|
|
@ -58,8 +58,8 @@ in
|
||||||
# Individual files to be included on the CD, outside of the Nix
|
# Individual files to be included on the CD, outside of the Nix
|
||||||
# store on the CD.
|
# store on the CD.
|
||||||
tarball.contents =
|
tarball.contents =
|
||||||
[ { source = config.system.build.initialRamdisk + "/initrd";
|
[ { source = config.system.build.initialRamdisk + "/" + config.system.boot.loader.initrdFile;
|
||||||
target = "/boot/initrd";
|
target = "/boot/" + config.system.boot.loader.initrdFile;
|
||||||
}
|
}
|
||||||
{ source = versionFile;
|
{ source = versionFile;
|
||||||
target = "/nixos-version.txt";
|
target = "/nixos-version.txt";
|
||||||
|
|
|
@ -30,6 +30,8 @@ let
|
||||||
let
|
let
|
||||||
kernelPath = "${config.boot.kernelPackages.kernel}/" +
|
kernelPath = "${config.boot.kernelPackages.kernel}/" +
|
||||||
"${config.system.boot.loader.kernelFile}";
|
"${config.system.boot.loader.kernelFile}";
|
||||||
|
initrdPath = "${config.system.build.initialRamdisk}/" +
|
||||||
|
"${config.system.boot.loader.initrdFile}";
|
||||||
in ''
|
in ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
|
|
||||||
|
@ -50,7 +52,7 @@ let
|
||||||
|
|
||||||
echo -n "$kernelParams" > $out/kernel-params
|
echo -n "$kernelParams" > $out/kernel-params
|
||||||
|
|
||||||
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd
|
ln -s ${initrdPath} $out/initrd
|
||||||
|
|
||||||
ln -s ${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets $out
|
ln -s ${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets $out
|
||||||
|
|
||||||
|
@ -179,6 +181,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
system.boot.loader.initrdFile = mkOption {
|
||||||
|
internal = true;
|
||||||
|
default = "initrd";
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Name of the initrd file to be passed to the bootloader.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
system.copySystemConfiguration = mkOption {
|
system.copySystemConfiguration = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
Loading…
Reference in New Issue