git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #50849 from cyounkins/startlimitinterval

nixos/systemd: add StartLimitIntervalSec to unit config

commit2a40236e60e6fe304094f1b519fac3c48f46f576 authorSilvan Mosberger <infinisil@icloud.com> dateMon 28 Jan 2019, 02:44 (8 years ago) parent078d8856f6287f
2 files changed+13−2
nixos/modules/system/boot/systemd-unit-options.nix+9 nixos/modules/system/boot/systemd.nix+4−2
nixos/modules/system/boot/systemd-unit-options.nix+9
@@ -210,6 +210,15 @@ in rec {
210210 '';
211211 };
212212
213+ startLimitIntervalSec = mkOption {
214+ type = types.int;
215+ description = ''
216+ Configure unit start rate limiting. Units which are started
217+ more than burst times within an interval time interval are
218+ not permitted to start any more.
219+ '';
220+ };
221+
213222 };
214223
215224
nixos/modules/system/boot/systemd.nix+4−2
@@ -193,7 +193,7 @@ let
193193 let mkScriptName = s: "unit-script-" + (replaceChars [ "\\" "@" ] [ "-" "_" ] (shellEscape s) );
194194 in pkgs.writeTextFile { name = mkScriptName name; executable = true; inherit text; };
195195
196− unitConfig = { config, ... }: {
196+ unitConfig = { config, options, ... }: {
197197 config = {
198198 unitConfig =
199199 optionalAttrs (config.requires != [])
@@ -219,7 +219,9 @@ let
219219 // optionalAttrs (config.documentation != []) {
220220 Documentation = toString config.documentation; }
221221 // optionalAttrs (config.onFailure != []) {
222− OnFailure = toString config.onFailure;
222+ OnFailure = toString config.onFailure; }
223+ // optionalAttrs (options.startLimitIntervalSec.isDefined) {
224+ StartLimitIntervalSec = toString config.startLimitIntervalSec;
223225 };
224226 };
225227 };