Created
February 22, 2021 10:47
-
-
Save sorki/5d073110270fcf3a99357d8c46110d88 to your computer and use it in GitHub Desktop.
nested NixOS containers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import <nixpkgs/nixos/tests/make-test-python.nix> ({pkgs, ...}: rec { | |
name = "nesting"; | |
meta = with pkgs.stdenv.lib.maintainers; { | |
maintainers = [ sorki ]; | |
}; | |
machine = { lib, ... }: | |
let makeNested = subConf: { | |
boot.enableContainers = true; | |
containers.nested = { | |
autoStart = true; | |
privateNetwork = true; | |
config = subConf; | |
}; | |
}; | |
in makeNested (makeNested {}); | |
testScript = '' | |
machine.start() | |
machine.wait_for_unit("container@nested.service") | |
machine.succeed("systemd-run --pty --machine=nested -- machinectl list | grep nested") | |
print( | |
machine.succeed( | |
"systemd-run --pty --machine=nested -- systemd-run --pty --machine=nested -- systemctl status" | |
) | |
) | |
''; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment