aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/interactive/vm.nix
blob: c1239a64043eae3d6b0b046e689dc93f5ff53fa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
  virtualisation.vmVariant.virtualisation = {
    memorySize = 4096;
    qemu.options = [
      "-vga none -device virtio-gpu-pci"
      "-smp 8"
    ];

    mountHostNixStore = true;
    writableStore = true;
    writableStoreUseTmpfs = false;

    sharedDirectories = {
      cwd = {
        target = "/mnt/.ro-cwd";
        source = ''"$OLDPWD"'';
        securityModel = "none";
      };
    };

    fileSystems = {
      "/mnt/.ro-cwd".options = [
        "ro"
        "noatime"
      ];
      "/mnt/cwd".overlay = {
        lowerdir = [ "/mnt/.ro-cwd" ];
        upperdir = "/tmp/.cwd/upper";
        workdir = "/tmp/.cwd/work";
      };

      "/mnt/src".overlay = {
        lowerdir = [ ../.. ];
        upperdir = "/tmp/.src/upper";
        workdir = "/tmp/.src/work";
      };
    };
  };

  systemd.services = {
    logrotate-checkconf.enable = false;
    hakurei-src-fix-ownership = {
      wantedBy = [ "multi-user.target" ];
      wants = [ "mnt-src.mount" ];
      after = [ "mnt-src.mount" ];
      serviceConfig = {
        Type = "oneshot";
        RemainAfterExit = true;
      };
      script = ''
        chown -R alice:users /mnt/src/
      '';
    };
  };
}