diff options
author | ajs124 <ajs124@users.noreply.github.com> | 2021-12-08 15:07:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-08 15:07:28 +0000 |
commit | eee45bb295b9e4550e778982136f5b8aa1ab37fc (patch) | |
tree | 717d84c48d49615acc43a3a0b2e33442572f339a /nixos | |
parent | 8010ff0d543d21fe639efd17f5ecb6e3e3ee9534 (diff) | |
parent | 851495a752f9f631cf47637df1d6e7a301920ba4 (diff) |
Merge pull request #146815 from ElvishJerricco/systemd-utils-expressions
Move systemd-lib.nix and systemd-unit-options.nix into utils
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/systemd-lib.nix (renamed from nixos/modules/system/boot/systemd-lib.nix) | 0 | ||||
-rw-r--r-- | nixos/lib/systemd-unit-options.nix (renamed from nixos/modules/system/boot/systemd-unit-options.nix) | 4 | ||||
-rw-r--r-- | nixos/lib/utils.nix | 7 | ||||
-rw-r--r-- | nixos/modules/misc/extra-arguments.nix | 4 | ||||
-rw-r--r-- | nixos/modules/security/systemd-confinement.nix | 6 | ||||
-rw-r--r-- | nixos/modules/services/backup/restic.nix | 4 | ||||
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 6 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd-nspawn.nix | 6 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 4 |
9 files changed, 22 insertions, 19 deletions
diff --git a/nixos/modules/system/boot/systemd-lib.nix b/nixos/lib/systemd-lib.nix index 6c4d27018eed..6c4d27018eed 100644 --- a/nixos/modules/system/boot/systemd-lib.nix +++ b/nixos/lib/systemd-lib.nix diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/lib/systemd-unit-options.nix index 4154389b2ce5..01f954a4d3e0 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/lib/systemd-unit-options.nix @@ -1,7 +1,7 @@ -{ config, lib }: +{ lib, systemdUtils }: +with systemdUtils.lib; with lib; -with import ./systemd-lib.nix { inherit config lib pkgs; }; let checkService = checkUnitConfig "Service" [ diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix index f1fa9f07a974..bbebf8ba35a0 100644 --- a/nixos/lib/utils.nix +++ b/nixos/lib/utils.nix @@ -1,4 +1,4 @@ -pkgs: with pkgs.lib; +{ lib, config, pkgs }: with lib; rec { @@ -165,4 +165,9 @@ rec { ${builtins.toJSON set} EOF ''; + + systemdUtils = { + lib = import ./systemd-lib.nix { inherit lib config pkgs; }; + unitOptions = import ./systemd-unit-options.nix { inherit lib systemdUtils; }; + }; } diff --git a/nixos/modules/misc/extra-arguments.nix b/nixos/modules/misc/extra-arguments.nix index 8716e3d9fef2..48891b440498 100644 --- a/nixos/modules/misc/extra-arguments.nix +++ b/nixos/modules/misc/extra-arguments.nix @@ -1,7 +1,7 @@ -{ pkgs, ... }: +{ lib, config, pkgs, ... }: { _module.args = { - utils = import ../../lib/utils.nix pkgs; + utils = import ../../lib/utils.nix { inherit lib config pkgs; }; }; } diff --git a/nixos/modules/security/systemd-confinement.nix b/nixos/modules/security/systemd-confinement.nix index d859c45c74f7..0e3ec5af323e 100644 --- a/nixos/modules/security/systemd-confinement.nix +++ b/nixos/modules/security/systemd-confinement.nix @@ -1,11 +1,9 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, utils, ... }: let toplevelConfig = config; inherit (lib) types; - inherit (import ../system/boot/systemd-lib.nix { - inherit config pkgs lib; - }) mkPathSafeName; + inherit (utils.systemdUtils.lib) mkPathSafeName; in { options.systemd.services = lib.mkOption { type = types.attrsOf (types.submodule ({ name, config, ... }: { diff --git a/nixos/modules/services/backup/restic.nix b/nixos/modules/services/backup/restic.nix index 67fef55614b3..8ff8e31864be 100644 --- a/nixos/modules/services/backup/restic.nix +++ b/nixos/modules/services/backup/restic.nix @@ -1,10 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, utils, ... }: with lib; let # Type for a valid systemd unit option. Needed for correctly passing "timerConfig" to "systemd.timers" - unitOption = (import ../../system/boot/systemd-unit-options.nix { inherit config lib; }).unitOption; + inherit (utils.systemdUtils.unitOptions) unitOption; in { options.services.restic.backups = mkOption { diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 5c074672b99c..83654b88dbdc 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -1,8 +1,8 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, utils, ... }: +with utils.systemdUtils.unitOptions; +with utils.systemdUtils.lib; with lib; -with import ./systemd-unit-options.nix { inherit config lib; }; -with import ./systemd-lib.nix { inherit config lib pkgs; }; let diff --git a/nixos/modules/system/boot/systemd-nspawn.nix b/nixos/modules/system/boot/systemd-nspawn.nix index b450d77429b2..02d2660add89 100644 --- a/nixos/modules/system/boot/systemd-nspawn.nix +++ b/nixos/modules/system/boot/systemd-nspawn.nix @@ -1,8 +1,8 @@ -{ config, lib , pkgs, ...}: +{ config, lib, pkgs, utils, ...}: +with utils.systemdUtils.unitOptions; +with utils.systemdUtils.lib; with lib; -with import ./systemd-unit-options.nix { inherit config lib; }; -with import ./systemd-lib.nix { inherit config lib pkgs; }; let cfg = config.systemd.nspawn; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 6e0ee437d915..ec5dea075bbc 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -1,9 +1,9 @@ { config, lib, pkgs, utils, ... }: with utils; +with systemdUtils.unitOptions; +with systemdUtils.lib; with lib; -with import ./systemd-unit-options.nix { inherit config lib; }; -with import ./systemd-lib.nix { inherit config lib pkgs; }; let |