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

+6 -1
nixos/lib/utils.nix
···
-
pkgs: with pkgs.lib;
+
{ lib, config, pkgs }: with lib;
rec {
···
${builtins.toJSON set}
EOF
'';
+
+
systemdUtils = {
+
lib = import ./systemd-lib.nix { inherit lib config pkgs; };
+
unitOptions = import ./systemd-unit-options.nix { inherit lib systemdUtils; };
+
};
}
+2 -2
nixos/modules/misc/extra-arguments.nix
···
-
{ pkgs, ... }:
+
{ lib, config, pkgs, ... }:
{
_module.args = {
-
utils = import ../../lib/utils.nix pkgs;
+
utils = import ../../lib/utils.nix { inherit lib config pkgs; };
};
}
+2 -4
nixos/modules/security/systemd-confinement.nix
···
-
{ 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, ... }: {
+2 -2
nixos/modules/services/backup/restic.nix
···
-
{ 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 {
+3 -3
nixos/modules/system/boot/networkd.nix
···
-
{ 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
nixos/modules/system/boot/systemd-lib.nix nixos/lib/systemd-lib.nix
+3 -3
nixos/modules/system/boot/systemd-nspawn.nix
···
-
{ 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;
+2 -2
nixos/modules/system/boot/systemd-unit-options.nix nixos/lib/systemd-unit-options.nix
···
-
{ config, lib }:
+
{ lib, systemdUtils }:
+
with systemdUtils.lib;
with lib;
-
with import ./systemd-lib.nix { inherit config lib pkgs; };
let
checkService = checkUnitConfig "Service" [
+2 -2
nixos/modules/system/boot/systemd.nix
···
{ 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