1 import ./make-test-python.nix ({ lib, ... }: {
2 name = "containers-require-bind-mounts";
3 meta.maintainers = with lib.maintainers; [ kira-bruneau ];
6 containers.require-bind-mounts = {
7 bindMounts = { "/srv/data" = {}; };
11 virtualisation.fileSystems = {
14 options = [ "noauto" ];
20 machine.wait_for_unit("default.target")
22 assert "require-bind-mounts" in machine.succeed("nixos-container list")
23 assert "down" in machine.succeed("nixos-container status require-bind-mounts")
24 assert "inactive" in machine.fail("systemctl is-active srv-data.mount")
26 with subtest("bind mount host paths must be mounted to run container"):
27 machine.succeed("nixos-container start require-bind-mounts")
28 assert "up" in machine.succeed("nixos-container status require-bind-mounts")
29 assert "active" in machine.succeed("systemctl status srv-data.mount")
31 machine.succeed("systemctl stop srv-data.mount")
32 assert "down" in machine.succeed("nixos-container status require-bind-mounts")
33 assert "inactive" in machine.fail("systemctl is-active srv-data.mount")