diff options
author | Jan Malakhovski <oxij@oxij.org> | 2019-04-18 10:40:48 +0000 |
---|---|---|
committer | Jan Malakhovski <oxij@oxij.org> | 2019-04-18 10:42:11 +0000 |
commit | 0017a06717bb18706ac3cb99432034caad0c8b91 (patch) | |
tree | bc9ea2fd1ccbdc7d5b670c8ce66538196166b6af /nixos/modules/system/boot/systemd.nix | |
parent | 9289a39a6987db87bd53c84835b830996540be7a (diff) | |
download | nixpkgs-0017a06717bb18706ac3cb99432034caad0c8b91.tar nixpkgs-0017a06717bb18706ac3cb99432034caad0c8b91.tar.gz nixpkgs-0017a06717bb18706ac3cb99432034caad0c8b91.tar.bz2 nixpkgs-0017a06717bb18706ac3cb99432034caad0c8b91.tar.lz nixpkgs-0017a06717bb18706ac3cb99432034caad0c8b91.tar.xz nixpkgs-0017a06717bb18706ac3cb99432034caad0c8b91.tar.zst nixpkgs-0017a06717bb18706ac3cb99432034caad0c8b91.zip |
nixos/systemd: add an option to suppress system units
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 18ee2ef1b8f..8118279fcd0 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -742,6 +742,18 @@ in ''; }; + systemd.suppressedSystemUnits = mkOption { + default = [ ]; + type = types.listOf types.str; + example = [ "systemd-backlight@.service" ]; + description = '' + A list of units to suppress when generating system systemd configuration directory. This has + priority over upstream units, <option>systemd.units</option>, and + <option>systemd.additionalUpstreamSystemUnits</option>. The main purpose of this is to + suppress a upstream systemd unit with any modifications made to it by other NixOS modules. + ''; + }; + }; @@ -771,8 +783,11 @@ in done; ${concatStrings (mapAttrsToList (generator: target: "ln -s ${target} $out/${generator};\n") cfg.generators)} ''; + + enabledUpstreamSystemUnits = filter (n: ! elem n cfg.suppressedSystemUnits) upstreamSystemUnits; + enabledUnits = filterAttrs (n: v: ! elem n cfg.suppressedSystemUnits) cfg.units; in ({ - "systemd/system".source = generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants; + "systemd/system".source = generateUnits "system" enabledUnits enabledUpstreamSystemUnits upstreamSystemWants; "systemd/user".source = generateUnits "user" cfg.user.units upstreamUserUnits []; |