diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index a7a334dec28..d4cab93b26b 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -170,6 +170,15 @@ in rec { ''; }; + onFailure = mkOption { + default = []; + type = types.listOf types.str; + description = '' + A list of one or more units that are activated when + this unit enters the "failed" state. + ''; + }; + }; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 0b7647093e0..d145baeebe9 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -199,6 +199,8 @@ let { X-Restart-Triggers = toString config.restartTriggers; } // optionalAttrs (config.description != "") { Description = config.description; + } // optionalAttrs (config.onFailure != []) { + OnFailure = toString config.onFailure; }; }; };