lxc-containers: add experimental lxc-reload on system change

This commit is contained in:
Astro 2021-04-04 23:03:25 +02:00
parent fd8cb77b40
commit 9fe5709976
1 changed files with 13 additions and 1 deletions

View File

@ -170,7 +170,19 @@ in
systemd.targets.lxc-containers = {
wantedBy = [ "multi-user.target" ];
wants = map (ctName: "lxc@${ctName}.service")
wants = builtins.concatMap (ctName: [ "lxc@${ctName}.service" "lxc-reload@${ctName}.path" ])
(builtins.attrNames containers);
};
systemd.paths."lxc-reload@" = {
pathConfig = {
PathChanged = "/var/lib/lxc/%i/rootfs/init";
};
};
systemd.services."lxc-reload@" = {
requires = [ "lxc@%i.service" ];
serviceConfig.Type = "oneshot";
scriptArgs = "%i";
script = "/run/current-system/systemd/bin/systemctl reload lxc@$1.service || true";
};
}