winstone NixOS module: Make it possible to set systemd service name

This commit is contained in:
Rickard Nilsson 2014-03-12 23:28:38 +01:00
parent 040df9c41a
commit 91e6d7411e

View File

@ -13,6 +13,14 @@ let
internal = true; internal = true;
}; };
serviceName = mkOption {
type = types.str;
description = ''
The name of the systemd service. By default, it is
derived from the winstone instance name.
'';
};
warFile = mkOption { warFile = mkOption {
type = types.str; type = types.str;
description = '' description = ''
@ -72,6 +80,7 @@ let
config = { config = {
workDir = mkDefault "/run/winstone/${name}"; workDir = mkDefault "/run/winstone/${name}";
serviceName = mkDefault "winstone-${name}";
}; };
}; };
@ -113,7 +122,7 @@ in {
config = mkIf (cfg != {}) { config = mkIf (cfg != {}) {
systemd.services = mapAttrs' (n: c: nameValuePair "winstone-${n}" (mkService c)) cfg; systemd.services = mapAttrs' (n: c: nameValuePair c.serviceName (mkService c)) cfg;
}; };