Merge pull request #292561 from arianvp/fix-make-disk-image-systemd-boot-homeless-shelter-clobber

nixos/lib/make-disk-image.nix: fix systemd-boot-builder clobbering /homeless-shelter
This commit is contained in:
Ryan Lahfa 2024-03-01 16:59:16 +01:00 committed by GitHub
commit fae73881ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -609,6 +609,13 @@ let format' = format; in let
''}
# Set up core system link, bootloader (sd-boot, GRUB, uboot, etc.), etc.
# NOTE: systemd-boot-builder.py calls nix-env --list-generations which
# clobbers $HOME/.nix-defexpr/channels/nixos This would cause a folder
# /homeless-shelter to show up in the final image which in turn breaks
# nix builds in the target image if sandboxing is turned off (through
# __noChroot for example).
export HOME=$TMPDIR
NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root $mountPoint -- /nix/var/nix/profiles/system/bin/switch-to-configuration boot
# The above scripts will generate a random machine-id and we don't want to bake a single ID into all our images

View File

@ -69,5 +69,8 @@ in
os.environ['NIX_DISK_IMAGE'] = tmp_disk_image.name
machine.succeed("findmnt --kernel --source ${rootFsDevice} --target /")
# Make sure systemd boot didn't clobber this
machine.succeed("[ ! -e /homeless-shelter ]")
'';
}