diff options
author | Sander van der Burg <svanderburg@gmail.com> | 2021-03-15 19:34:09 +0100 |
---|---|---|
committer | Sander van der Burg <sander.van.der.burg@mendix.com> | 2021-03-22 20:41:12 +0100 |
commit | 5c8ed06fc9dbdf92681101d4fd91c690293ae007 (patch) | |
tree | 477207c77b4fc66d62c2aec2218011edd9fd72a1 /nixos/modules/system/boot/stage-2.nix | |
parent | f6092fe869272327a95d539d78ea8ebe15c34610 (diff) | |
download | nixpkgs-5c8ed06fc9dbdf92681101d4fd91c690293ae007.tar nixpkgs-5c8ed06fc9dbdf92681101d4fd91c690293ae007.tar.gz nixpkgs-5c8ed06fc9dbdf92681101d4fd91c690293ae007.tar.bz2 nixpkgs-5c8ed06fc9dbdf92681101d4fd91c690293ae007.tar.lz nixpkgs-5c8ed06fc9dbdf92681101d4fd91c690293ae007.tar.xz nixpkgs-5c8ed06fc9dbdf92681101d4fd91c690293ae007.tar.zst nixpkgs-5c8ed06fc9dbdf92681101d4fd91c690293ae007.zip |
systemd: allow custom unit folders to be configured with SYSTEMD_UNIT_PATH
Diffstat (limited to 'nixos/modules/system/boot/stage-2.nix')
-rw-r--r-- | nixos/modules/system/boot/stage-2.nix | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix index 94bc34fea0d..f6b6a8e4b0b 100644 --- a/nixos/modules/system/boot/stage-2.nix +++ b/nixos/modules/system/boot/stage-2.nix @@ -10,7 +10,7 @@ let src = ./stage-2-init.sh; shellDebug = "${pkgs.bashInteractive}/bin/bash"; shell = "${pkgs.bash}/bin/bash"; - inherit (config.boot) systemdExecutable; + inherit (config.boot) systemdExecutable extraSystemdUnitPaths; isExecutable = true; inherit (config.nix) readOnlyStore; inherit useHostResolvConf; @@ -20,6 +20,10 @@ let pkgs.util-linux ] ++ lib.optional useHostResolvConf pkgs.openresolv); fsPackagesPath = lib.makeBinPath config.system.fsPackages; + systemdUnitPathEnvVar = lib.optionalString (config.boot.extraSystemdUnitPaths != []) + ("SYSTEMD_UNIT_PATH=" + + builtins.concatStringsSep ":" config.boot.extraSystemdUnitPaths + + ":"); # If SYSTEMD_UNIT_PATH ends with an empty component (":"), the usual unit load path will be appended to the contents of the variable postBootCommands = pkgs.writeText "local-cmds" '' ${config.boot.postBootCommands} @@ -82,6 +86,15 @@ in PATH. ''; }; + + extraSystemdUnitPaths = mkOption { + default = []; + type = types.listOf types.str; + description = '' + Additional paths that get appended to the SYSTEMD_UNIT_PATH environment variable + that can contain mutable unit files. + ''; + }; }; }; |