From 8c58832c7df6589b31df53815b8173be2410d4da Mon Sep 17 00:00:00 2001 From: Christopher Bacher Date: Tue, 18 Oct 2022 21:04:39 +0200 Subject: [PATCH] modules(pihole-container): improve stopping of the container The service only waits until the container has been stopped. --- modules/pihole-container.factory.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/pihole-container.factory.nix b/modules/pihole-container.factory.nix index acf2fb7..e5d73e3 100644 --- a/modules/pihole-container.factory.nix +++ b/modules/pihole-container.factory.nix @@ -340,10 +340,15 @@ in rec { } \ docker-archive:${piholeFlake.packages.${pkgs.system}.piholeImage} ''; - ExecStopPost = "${pkgs.coreutils}/bin/sleep 30"; #TODO check that user can control podman & has subuidmap/subgidmap set User = "${cfg.hostConfig.user}"; }; + + postStop = '' + while ${pkgs.podman}/bin/podman container exists ${cfg.hostConfig.containerName}; do + ${pkgs.coreutils-full}/bin/sleep 2; + done + ''; }; }; }