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