summary refs log tree commit diff
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2021-11-20 12:34:13 -0500
committerWill Fancher <elvishjerricco@gmail.com>2021-11-20 17:52:29 -0500
commit851495a752f9f631cf47637df1d6e7a301920ba4 (patch)
treee466715084d8d6d945e989656a86bff987a73df3
parent715f63411952c86c8f57ab9e3e3cb866a015b5f2 (diff)
downloadnixpkgs-851495a752f9f631cf47637df1d6e7a301920ba4.tar
nixpkgs-851495a752f9f631cf47637df1d6e7a301920ba4.tar.gz
nixpkgs-851495a752f9f631cf47637df1d6e7a301920ba4.tar.bz2
nixpkgs-851495a752f9f631cf47637df1d6e7a301920ba4.tar.lz
nixpkgs-851495a752f9f631cf47637df1d6e7a301920ba4.tar.xz
nixpkgs-851495a752f9f631cf47637df1d6e7a301920ba4.tar.zst
nixpkgs-851495a752f9f631cf47637df1d6e7a301920ba4.zip
Move systemd-lib.nix and systemd-unit-options.nix into utils
-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.nix7
-rw-r--r--nixos/modules/misc/extra-arguments.nix4
-rw-r--r--nixos/modules/security/systemd-confinement.nix6
-rw-r--r--nixos/modules/services/backup/restic.nix4
-rw-r--r--nixos/modules/system/boot/networkd.nix6
-rw-r--r--nixos/modules/system/boot/systemd-nspawn.nix6
-rw-r--r--nixos/modules/system/boot/systemd.nix4
9 files changed, 22 insertions, 19 deletions
diff --git a/nixos/modules/system/boot/systemd-lib.nix b/nixos/lib/systemd-lib.nix
index 6c4d27018ee..6c4d27018ee 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 4154389b2ce..01f954a4d3e 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 f1fa9f07a97..bbebf8ba35a 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 8716e3d9fef..48891b44049 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 d859c45c74f..0e3ec5af323 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 67fef55614b..8ff8e31864b 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 2e17bdf6bb6..28060be2c3c 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 b450d77429b..02d2660add8 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 8fcf62d7fbf..c2ad043b789 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