]> git.scottworley.com Git - nixos-qemu-vm-isolation/blob - checks/mount-grep.nix
90ae4a7d8e3c33b59228e3c81703ad4706bc3f2f
[nixos-qemu-vm-isolation] / checks / mount-grep.nix
1 pkgs: {
2 name = "qemu-private-store-mount-grep";
3
4 hostPkgs = pkgs;
5
6 nodes = {
7 shared = _: { };
8 private = _: { imports = [ ../modules/qemu-vm-isolation.nix ]; };
9 useNixStoreImage = {
10 virtualisation = {
11 sharedDirectories = pkgs.lib.mkForce { };
12 useNixStoreImage = true;
13 };
14 };
15 };
16
17 testScript = ''
18 start_all()
19 shared.wait_for_unit("multi-user.target")
20 private.wait_for_unit("multi-user.target")
21 useNixStoreImage.wait_for_unit("multi-user.target")
22
23 shared.succeed("[[ $(mount | grep -c virt) -gt 0 ]]")
24 private.succeed("[[ $(mount | grep -c virt) -eq 0 ]]")
25 useNixStoreImage.succeed("[[ $(mount | grep -c virt) -eq 0 ]]")
26
27 shared.succeed("[[ -e ${pkgs.pv} ]]")
28 private.fail("[[ -e ${pkgs.pv} ]]")
29
30 # useNixStoreImage isn't ready until this works:
31 # useNixStoreImage.fail("[[ -e ${pkgs.pv} ]]")
32 '';
33 }