1 import ./make-test-python.nix ({ lib, ... }:
57 "PrivateUsersOwnership"
63 "VirtualEthernetExtra"
72 optionsToConfig = opts: builtins.listToAttrs (map (n: lib.nameValuePair n "testdata") opts);
74 grepForOptions = opts: ''node.succeed(
75 "for o in ${builtins.concatStringsSep " " opts} ; do grep --quiet $o ${configFile} || exit 1 ; done"
78 unitName = "options-test";
79 configFile = "/etc/systemd/nspawn/${unitName}.nspawn";
83 name = "systemd-nspawn-configfile";
86 node = { pkgs, ... }: {
87 systemd.nspawn."${unitName}" = {
90 execConfig = optionsToConfig execOptions // {
96 filesConfig = optionsToConfig filesOptions // {
99 PrivateUsersChown = true;
100 PrivateUsersOwnership = "auto";
103 networkConfig = optionsToConfig networkOptions // {
105 VirtualEthernet = true;
114 node.wait_for_file("${configFile}")
116 with subtest("Test for presence of all specified options in config file"):
117 ${grepForOptions execOptions}
118 ${grepForOptions filesOptions}
119 ${grepForOptions networkOptions}
121 with subtest("Test for absence of misspelled option 'MachineId' (instead of 'MachineID')"):
122 node.fail("grep --quiet MachineId ${configFile}")
126 lib.maintainers.zi3m5f