From c46a3dc50aa7c89cca3fd7245d84c0dcb7f4de1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Wed, 13 Jul 2022 09:15:44 -0500 Subject: [PATCH] cachix-agent: allow restarts now that deployments are subprocesses --- nixos/modules/services/system/cachix-agent/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/system/cachix-agent/default.nix b/nixos/modules/services/system/cachix-agent/default.nix index 3d2e9bc374ba..ed37c5784ce1 100644 --- a/nixos/modules/services/system/cachix-agent/default.nix +++ b/nixos/modules/services/system/cachix-agent/default.nix @@ -52,12 +52,15 @@ in { path = [ config.nix.package ]; wantedBy = [ "multi-user.target" ]; - # don't restart while changing - restartIfChanged = false; + # Cachix requires $USER to be set + environment.USER = "root"; + + # don't stop the service if the unit disappears unitConfig.X-StopOnRemoval = false; - environment.USER = "root"; serviceConfig = { + # we don't want to kill children processes as those are deployments + KillMode = "process"; Restart = "on-failure"; EnvironmentFile = cfg.credentialsFile; ExecStart = "${cfg.package}/bin/cachix ${lib.optionalString cfg.verbose "--verbose"} deploy agent ${cfg.name} ${if cfg.profile != null then profile else ""}";