Allow a unit to declare "triggers" that force a restart
The triggers are just arbitrary strings that are included in the unit under X-Restart-Triggers. The idea is that if they change between reconfigurations, switch-to-configuration will restart the unit because its store path changed. This is mostly useful for services that implicitly depend on generated files in /etc. Thus you can say restartTriggers = [ confFile ]; where ‘confFile’ is the derivation that generated the /etc file in question.
This commit is contained in:
parent
285f587025
commit
b606165bd9
@ -83,6 +83,15 @@ rec {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
restartTriggers = mkOption {
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
An arbitrary list of items such as derivations. If any item
|
||||||
|
in the list changes between reconfigurations, the service will
|
||||||
|
be restarted.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,6 +176,7 @@ let
|
|||||||
Before = concatStringsSep " " config.before;
|
Before = concatStringsSep " " config.before;
|
||||||
BindsTo = concatStringsSep " " config.bindsTo;
|
BindsTo = concatStringsSep " " config.bindsTo;
|
||||||
PartOf = concatStringsSep " " config.partOf;
|
PartOf = concatStringsSep " " config.partOf;
|
||||||
|
"X-Restart-Triggers" = toString config.restartTriggers;
|
||||||
} // optionalAttrs (config.description != "") {
|
} // optionalAttrs (config.description != "") {
|
||||||
Description = config.description;
|
Description = config.description;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user