diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2022-03-19 23:00:27 -0400 |
---|---|---|
committer | Will Fancher <elvishjerricco@gmail.com> | 2022-03-22 21:28:50 -0400 |
commit | be10e86c9587d3207c8d4a850a72ed88124d1aac (patch) | |
tree | bd54ef73979b142182e03716b9cc7a94fc3f9ee9 /nixos/modules | |
parent | 2d4ebf1259149ac52c191f461eef4eae6c3671fc (diff) | |
download | nixpkgs-be10e86c9587d3207c8d4a850a72ed88124d1aac.tar nixpkgs-be10e86c9587d3207c8d4a850a72ed88124d1aac.tar.gz nixpkgs-be10e86c9587d3207c8d4a850a72ed88124d1aac.tar.bz2 nixpkgs-be10e86c9587d3207c8d4a850a72ed88124d1aac.tar.lz nixpkgs-be10e86c9587d3207c8d4a850a72ed88124d1aac.tar.xz nixpkgs-be10e86c9587d3207c8d4a850a72ed88124d1aac.tar.zst nixpkgs-be10e86c9587d3207c8d4a850a72ed88124d1aac.zip |
systemd-initrd: Partially fix qemu-vm
TODO: Auto formatting / partitioning / resizing
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/virtualisation/qemu-vm.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 51438935894..f8653a6f34a 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -953,6 +953,28 @@ in }; } // lib.mapAttrs' mkSharedDir cfg.sharedDirectories); + boot.initrd.systemd = lib.mkIf (config.boot.initrd.systemd.enable && cfg.writableStore) { + mounts = [{ + where = "/sysroot/nix/store"; + what = "overlay"; + type = "overlay"; + options = "lowerdir=/sysroot/nix/.ro-store,upperdir=/sysroot/nix/.rw-store/store,workdir=/sysroot/nix/.rw-store/work"; + wantedBy = ["local-fs.target"]; + before = ["local-fs.target"]; + requires = ["sysroot-nix-.ro\\x2dstore.mount" "sysroot-nix-.rw\\x2dstore.mount" "rw-store.service"]; + after = ["sysroot-nix-.ro\\x2dstore.mount" "sysroot-nix-.rw\\x2dstore.mount" "rw-store.service"]; + unitConfig.IgnoreOnIsolate = true; + }]; + services.rw-store = { + after = ["sysroot-nix-.rw\\x2dstore.mount"]; + unitConfig.DefaultDependencies = false; + serviceConfig = { + Type = "oneshot"; + ExecStart = "/bin/mkdir -p 0755 /sysroot/nix/.rw-store/store /sysroot/nix/.rw-store/work /sysroot/nix/store"; + }; + }; + }; + swapDevices = mkVMOverride [ ]; boot.initrd.luks.devices = mkVMOverride {}; |