summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornikstur <nikstur@outlook.com>2024-02-22 00:12:04 +0100
committernikstur <nikstur@outlook.com>2024-07-18 19:09:28 +0200
commit54674e9063317a41b498b40ce856614bd5b7050f (patch)
treeaec474d84a2a0be6b9ee2dc602cc7dbe9ccf7430
parentMerge pull request #294597 from TomaSajt/axis2 (diff)
downloadnixpkgs-54674e9063317a41b498b40ce856614bd5b7050f.tar.gz
nixos/qemu-vm: remove duplication between scripted and systemd initrd
-rw-r--r--nixos/modules/virtualisation/qemu-vm.nix26
1 files changed, 7 insertions, 19 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index d1dc6404d4f5..f8a9602697a4 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -1046,26 +1046,14 @@ in
boot.loader.supportsInitrdSecrets = mkIf (!cfg.useBootLoader) (mkVMOverride false);
- boot.initrd.postMountCommands = lib.mkIf (!config.boot.initrd.systemd.enable)
- ''
- # Mark this as a NixOS machine.
- mkdir -p $targetRoot/etc
- echo -n > $targetRoot/etc/NIXOS
-
- # Fix the permissions on /tmp.
- chmod 1777 $targetRoot/tmp
-
- mkdir -p $targetRoot/boot
-
- ${optionalString cfg.writableStore ''
- echo "mounting overlay filesystem on /nix/store..."
- mkdir -p -m 0755 $targetRoot/nix/.rw-store/store $targetRoot/nix/.rw-store/work $targetRoot/nix/store
- mount -t overlay overlay $targetRoot/nix/store \
- -o lowerdir=$targetRoot/nix/.ro-store,upperdir=$targetRoot/nix/.rw-store/store,workdir=$targetRoot/nix/.rw-store/work || fail
- ''}
- '';
+ boot.initrd.postMountCommands = lib.mkIf (!config.boot.initrd.systemd.enable && cfg.writableStore) ''
+ echo "mounting overlay filesystem on /nix/store..."
+ mkdir -p -m 0755 $targetRoot/nix/.rw-store/store $targetRoot/nix/.rw-store/work $targetRoot/nix/store
+ mount -t overlay overlay $targetRoot/nix/store \
+ -o lowerdir=$targetRoot/nix/.ro-store,upperdir=$targetRoot/nix/.rw-store/store,workdir=$targetRoot/nix/.rw-store/work || fail
+ '';
- systemd.tmpfiles.settings."10-qemu-vm" = lib.mkIf config.boot.initrd.systemd.enable {
+ systemd.tmpfiles.settings."10-qemu-vm" = {
"/etc/NIXOS".f = {
mode = "0644";
user = "root";