|
|
|
@ -176,22 +176,10 @@ in
|
|
|
|
|
systemd.services."lxc@" = {
|
|
|
|
|
description = "LXC container '%i'";
|
|
|
|
|
after = [ "network.target" ];
|
|
|
|
|
unitConfig.ConditionPathExists = "/var/lib/lxc/%i/rootfs/init";
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Type = "simple";
|
|
|
|
|
ExecStart =
|
|
|
|
|
let
|
|
|
|
|
script = pkgs.writeScript "start-lxc-container.sh" ''
|
|
|
|
|
#! ${pkgs.runtimeShell} -e
|
|
|
|
|
|
|
|
|
|
if [ ! -e /var/lib/lxc/$1/rootfs ]; then
|
|
|
|
|
echo "Container $1 does not exist. Run: build-container $1"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
exec ${pkgs.lxc}/bin/lxc-start -F -C -n $1
|
|
|
|
|
'';
|
|
|
|
|
in
|
|
|
|
|
"${script} %i";
|
|
|
|
|
ExecStart = "${pkgs.lxc}/bin/lxc-start -F -C -n %i";
|
|
|
|
|
ExecStop = "${pkgs.lxc}/bin/lxc-stop -n %i";
|
|
|
|
|
ExecReload =
|
|
|
|
|
let
|
|
|
|
|