From 0437b5f9a455b5b02c433b818289011d7ed3d3ef Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 24 Jun 2024 09:46:16 +0200 Subject: [PATCH] nixos-module: Type=oneshot This may improve the shutdown behavior --- nixos-module.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/nixos-module.nix b/nixos-module.nix index c4f7beb..58d096d 100644 --- a/nixos-module.nix +++ b/nixos-module.nix @@ -42,10 +42,22 @@ let cfg.docker.client.package ]; environment.ARION_PREBUILT = config.settings.out.dockerComposeYaml; - script = '' - echo 1>&2 "docker compose file: $ARION_PREBUILT" - arion --prebuilt-file "$ARION_PREBUILT" up - ''; + serviceConfig.Type = "oneshot"; + serviceConfig.RemainAfterExit = true; + serviceConfig.ExecStart = [ + (lib.getExe (pkgs.writeScriptBin "nixos-arion-start" '' + #!${pkgs.runtimeShell} + echo 1>&2 "starting arion project: $ARION_PREBUILT" + arion --prebuilt-file "$ARION_PREBUILT" up --detach + '')) + ]; + serviceConfig.ExecStop = [ + (lib.getExe (pkgs.writeScriptBin "nixos-arion-stop" '' + #!${pkgs.runtimeShell} + echo 1>&2 "stopping arion project: $ARION_PREBUILT" + arion --prebuilt-file "$ARION_PREBUILT" down + '')) + ]; }; }; };