From 58be28d7ce5b559c1547d437743ec7890b43eff5 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Wed, 10 Mar 2021 21:53:06 +0100 Subject: [PATCH] nixos/spacecookie: add package option This allows to change the derivation to use for the spacecookie server binary. We probably should also use justStaticExecutables by default to reduce the runtime closure of the service. --- nixos/modules/services/networking/spacecookie.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/spacecookie.nix b/nixos/modules/services/networking/spacecookie.nix index 29c1c0f0012..4ddb137876d 100644 --- a/nixos/modules/services/networking/spacecookie.nix +++ b/nixos/modules/services/networking/spacecookie.nix @@ -15,6 +15,18 @@ in { enable = mkEnableOption "spacecookie"; + package = mkOption { + type = types.package; + default = pkgs.haskellPackages.spacecookie; + example = literalExample '' + pkgs.haskell.lib.justStaticExecutables pkgs.haskellPackages.spacecookie + ''; + description = '' + The spacecookie derivation to use. This can be used to + override the used package or to use another version. + ''; + }; + hostname = mkOption { type = types.str; default = "localhost"; @@ -62,7 +74,7 @@ in { serviceConfig = { Type = "notify"; - ExecStart = "${pkgs.haskellPackages.spacecookie}/bin/spacecookie ${configFile}"; + ExecStart = "${lib.getBin cfg.package}/bin/spacecookie ${configFile}"; FileDescriptorStoreMax = 1; DynamicUser = true;