From 4d64e1755794cd8364afce6dbcbea72c04466dfa Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 18 Jan 2023 20:06:48 +0100 Subject: l sync-containers3: remove interface on container shutdown --- lass/3modules/sync-containers3.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lass/3modules/sync-containers3.nix b/lass/3modules/sync-containers3.nix index 03eb14e6..7966f409 100644 --- a/lass/3modules/sync-containers3.nix +++ b/lass/3modules/sync-containers3.nix @@ -235,6 +235,13 @@ in { ''; }; }; } + { "container@${ctr.name}" = lib.mkIf ctr.runContainer { + serviceConfig = { + ExecStop = pkgs.writers.writeDash "remove_interface" '' + ${pkgs.iproute2}/bin/ip link del vb-${ctr.name} + ''; + }; + }; } ]) (lib.attrValues cfg.containers))); systemd.timers = lib.mapAttrs' (n: ctr: lib.nameValuePair "${ctr.name}_syncer" { -- cgit v1.2.3