From f7dabd8e2d6438435e2c7540004cc3111cd6e0d0 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 18 Nov 2021 16:58:32 +0100 Subject: [PATCH] nixos-module/server/lxc-container: split container build and activation phases --- nix/nixos-module/server/lxc-containers.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nix/nixos-module/server/lxc-containers.nix b/nix/nixos-module/server/lxc-containers.nix index 311f0bb..b62b716 100644 --- a/nix/nixos-module/server/lxc-containers.nix +++ b/nix/nixos-module/server/lxc-containers.nix @@ -122,8 +122,12 @@ let mkdir -p /var/lib/lxc/$c/rootfs/$d done ln -fs $SYSTEM/init /var/lib/lxc/$c/rootfs/init + done - set +e + # Activate all the desired container after all of them are + # built + set +e + for c in $@; do active=$(systemctl is-active lxc@$c) if [[ "$active" = active ]] ; then echo Activating $c @@ -135,8 +139,8 @@ let echo Starting $c systemctl start lxc@$c fi - set -e done + set -e ''; enable-script = pkgs.writeScriptBin "enable-containers" ''