Don't include superfluous lines in generated units

This commit is contained in:
Eelco Dolstra 2014-03-12 18:35:50 +01:00
parent d412245601
commit 207c881df9
2 changed files with 18 additions and 9 deletions

View File

@ -141,6 +141,7 @@ in rec {
restartTriggers = mkOption { restartTriggers = mkOption {
default = []; default = [];
type = types.listOf types.unspecified;
description = '' description = ''
An arbitrary list of items such as derivations. If any item An arbitrary list of items such as derivations. If any item
in the list changes between reconfigurations, the service will in the list changes between reconfigurations, the service will

View File

@ -145,15 +145,23 @@ let
unitConfig = { name, config, ... }: { unitConfig = { name, config, ... }: {
config = { config = {
unitConfig = unitConfig =
{ Requires = concatStringsSep " " config.requires; optionalAttrs (config.requires != [])
Wants = concatStringsSep " " config.wants; { Requires = toString config.requires; }
After = concatStringsSep " " config.after; // optionalAttrs (config.wants != [])
Before = concatStringsSep " " config.before; { Wants = toString config.wants; }
BindsTo = concatStringsSep " " config.bindsTo; // optionalAttrs (config.after != [])
PartOf = concatStringsSep " " config.partOf; { After = toString config.after; }
Conflicts = concatStringsSep " " config.conflicts; // optionalAttrs (config.before != [])
X-Restart-Triggers = toString config.restartTriggers; { Before = toString config.before; }
} // optionalAttrs (config.description != "") { // optionalAttrs (config.bindsTo != [])
{ BindsTo = toString config.bindsTo; }
// optionalAttrs (config.partOf != [])
{ PartOf = toString config.partOf; }
// optionalAttrs (config.conflicts != [])
{ Conflicts = toString config.conflicts; }
// optionalAttrs (config.restartTriggers != [])
{ X-Restart-Triggers = toString config.restartTriggers; }
// optionalAttrs (config.description != "") {
Description = config.description; Description = config.description;
}; };
}; };