···
···
# specified on the kernel command line, created in the stage 1
"/iso" = lib.mkImageMediaOverride {
788
-
device = "/dev/root";
790
+
if config.boot.initrd.systemd.enable then
791
+
"/dev/disk/by-label/${config.isoImage.volumeID}"
···
# image) to make this a live CD.
"/nix/.ro-store" = lib.mkImageMediaOverride {
797
-
device = "/iso/nix-store.squashfs";
802
+
device = "${lib.optionalString config.boot.initrd.systemd.enable "/sysroot"}/iso/nix-store.squashfs";
···
"/nix/store" = lib.mkImageMediaOverride {
812
-
fsType = "overlay";
813
-
device = "overlay";
815
-
"lowerdir=/nix/.ro-store"
816
-
"upperdir=/nix/.rw-store/store"
817
-
"workdir=/nix/.rw-store/work"
821
-
"/nix/.rw-store/store"
822
-
"/nix/.rw-store/work"
818
+
lowerdir = [ "/nix/.ro-store" ];
819
+
upperdir = "/nix/.rw-store/store";
820
+
workdir = "/nix/.rw-store/work";
···
# UUID of the USB stick. It would be nicer to write
# `root=/dev/disk/by-label/...' here, but UNetbootin doesn't
885
-
boot.kernelParams = [
886
-
"root=LABEL=${config.isoImage.volumeID}"
883
+
boot.kernelParams = lib.optionals (!config.boot.initrd.systemd.enable) [
885
+
"root=LABEL=${config.isoImage.volumeID}"
fileSystems = config.lib.isoFileSystems;
···
902
+
boot.initrd.systemd = lib.mkIf config.boot.initrd.systemd.enable {
903
+
emergencyAccess = true;
905
+
# Most of util-linux is not included by default.
906
+
initrdBin = [ config.boot.initrd.systemd.package.util-linux ];
907
+
services.copytoram = {
908
+
description = "Copy ISO contents to RAM";
909
+
requiredBy = [ "initrd.target" ];
911
+
"${utils.escapeSystemdPath "/sysroot/nix/.ro-store"}.mount"
912
+
"initrd-switch-root.target"
915
+
RequiresMountsFor = "/sysroot/iso";
916
+
ConditionKernelCommandLine = "copytoram";
920
+
RemainAfterExit = true;
924
+
config.boot.initrd.systemd.package.util-linux
927
+
device=$(findmnt -n -o SOURCE --target /sysroot/iso)
928
+
fsSize=$(blockdev --getsize64 "$device" || stat -Lc '%s' "$device")
930
+
mount --bind --make-private /sysroot/iso /tmp-iso
931
+
umount /sysroot/iso
932
+
mount -t tmpfs -o size="$fsSize" tmpfs /sysroot/iso
933
+
cp -r /tmp-iso/* /sysroot/iso/
# Closures to be copied to the Nix store on the CD, namely the init
# script and the top-level system configuration directory.
isoImage.storeContents = [
···
962
-
source = (pkgs.writeTextDir "grub/loopback.cfg" "source /EFI/BOOT/grub.cfg") + "/grub";
963
-
target = "/boot/grub";
source = config.isoImage.efiSplashImage;
target = "/EFI/BOOT/efi-background.png";
1002
+
++ lib.optionals (config.isoImage.makeEfiBootable && !config.boot.initrd.systemd.enable) [
1003
+
# http://www.supergrubdisk.org/wiki/Loopback.cfg
1004
+
# This feature will be removed, and thus is not supported by systemd initrd
1006
+
source = (pkgs.writeTextDir "grub/loopback.cfg" "source /EFI/BOOT/grub.cfg") + "/grub";
1007
+
target = "/boot/grub";
++ lib.optionals (config.boot.loader.grub.memtest86.enable && config.isoImage.makeBiosBootable) [