Merge pull request #146815 from ElvishJerricco/systemd-utils-expressions

Move systemd-lib.nix and systemd-unit-options.nix into utils

authored by ajs124 and committed by GitHub eee45bb2 8010ff0d

+22 -19
+6 -1
nixos/lib/utils.nix
··· 1 - pkgs: with pkgs.lib; 1 + { lib, config, pkgs }: with lib; 2 2 3 3 rec { 4 4 ··· 165 165 ${builtins.toJSON set} 166 166 EOF 167 167 ''; 168 + 169 + systemdUtils = { 170 + lib = import ./systemd-lib.nix { inherit lib config pkgs; }; 171 + unitOptions = import ./systemd-unit-options.nix { inherit lib systemdUtils; }; 172 + }; 168 173 }
+2 -2
nixos/modules/misc/extra-arguments.nix
··· 1 - { pkgs, ... }: 1 + { lib, config, pkgs, ... }: 2 2 3 3 { 4 4 _module.args = { 5 - utils = import ../../lib/utils.nix pkgs; 5 + utils = import ../../lib/utils.nix { inherit lib config pkgs; }; 6 6 }; 7 7 }
+2 -4
nixos/modules/security/systemd-confinement.nix
··· 1 - { config, pkgs, lib, ... }: 1 + { config, pkgs, lib, utils, ... }: 2 2 3 3 let 4 4 toplevelConfig = config; 5 5 inherit (lib) types; 6 - inherit (import ../system/boot/systemd-lib.nix { 7 - inherit config pkgs lib; 8 - }) mkPathSafeName; 6 + inherit (utils.systemdUtils.lib) mkPathSafeName; 9 7 in { 10 8 options.systemd.services = lib.mkOption { 11 9 type = types.attrsOf (types.submodule ({ name, config, ... }: {
+2 -2
nixos/modules/services/backup/restic.nix
··· 1 - { config, lib, pkgs, ... }: 1 + { config, lib, pkgs, utils, ... }: 2 2 3 3 with lib; 4 4 5 5 let 6 6 # Type for a valid systemd unit option. Needed for correctly passing "timerConfig" to "systemd.timers" 7 - unitOption = (import ../../system/boot/systemd-unit-options.nix { inherit config lib; }).unitOption; 7 + inherit (utils.systemdUtils.unitOptions) unitOption; 8 8 in 9 9 { 10 10 options.services.restic.backups = mkOption {
+3 -3
nixos/modules/system/boot/networkd.nix
··· 1 - { config, lib, pkgs, ... }: 1 + { config, lib, pkgs, utils, ... }: 2 2 3 + with utils.systemdUtils.unitOptions; 4 + with utils.systemdUtils.lib; 3 5 with lib; 4 - with import ./systemd-unit-options.nix { inherit config lib; }; 5 - with import ./systemd-lib.nix { inherit config lib pkgs; }; 6 6 7 7 let 8 8
nixos/modules/system/boot/systemd-lib.nix nixos/lib/systemd-lib.nix
+3 -3
nixos/modules/system/boot/systemd-nspawn.nix
··· 1 - { config, lib , pkgs, ...}: 1 + { config, lib, pkgs, utils, ...}: 2 2 3 + with utils.systemdUtils.unitOptions; 4 + with utils.systemdUtils.lib; 3 5 with lib; 4 - with import ./systemd-unit-options.nix { inherit config lib; }; 5 - with import ./systemd-lib.nix { inherit config lib pkgs; }; 6 6 7 7 let 8 8 cfg = config.systemd.nspawn;
+2 -2
nixos/modules/system/boot/systemd-unit-options.nix nixos/lib/systemd-unit-options.nix
··· 1 - { config, lib }: 1 + { lib, systemdUtils }: 2 2 3 + with systemdUtils.lib; 3 4 with lib; 4 - with import ./systemd-lib.nix { inherit config lib pkgs; }; 5 5 6 6 let 7 7 checkService = checkUnitConfig "Service" [
+2 -2
nixos/modules/system/boot/systemd.nix
··· 1 1 { config, lib, pkgs, utils, ... }: 2 2 3 3 with utils; 4 + with systemdUtils.unitOptions; 5 + with systemdUtils.lib; 4 6 with lib; 5 - with import ./systemd-unit-options.nix { inherit config lib; }; 6 - with import ./systemd-lib.nix { inherit config lib pkgs; }; 7 7 8 8 let 9 9