0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 14:10:33 +03:00

nixos/*qemu*: Add systemd initrd support

This commit is contained in:
Janne Heß 2022-04-30 19:17:57 +02:00
parent 5b47056b7d
commit 007108f04d
No known key found for this signature in database
GPG key ID: 69165158F05265DF
3 changed files with 29 additions and 31 deletions

View file

@ -754,13 +754,13 @@ in
);
boot.loader.grub.gfxmodeBios = with cfg.resolution; "${toString x}x${toString y}";
boot.initrd.extraUtilsCommands =
boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable)
''
# We need mke2fs in the initrd.
copy_bin_and_libs ${pkgs.e2fsprogs}/bin/mke2fs
'';
boot.initrd.postDeviceCommands =
boot.initrd.postDeviceCommands = lib.mkIf (!config.boot.initrd.systemd.enable)
''
# If the disk image appears to be empty, run mke2fs to
# initialise.
@ -770,7 +770,7 @@ in
fi
'';
boot.initrd.postMountCommands =
boot.initrd.postMountCommands = lib.mkIf (!config.boot.initrd.systemd.enable)
''
# Mark this as a NixOS machine.
mkdir -p $targetRoot/etc
@ -789,6 +789,11 @@ in
''}
'';
systemd.tmpfiles.rules = lib.mkIf config.boot.initrd.systemd.enable [
"f /etc/NIXOS 0644 root root -"
"d /boot 0644 root root -"
];
# After booting, register the closure of the paths in
# `virtualisation.additionalPaths' in the Nix database in the VM. This
# allows Nix operations to work in the VM. The path to the