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