mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
nixos/systemd: add defaultPath option
This commit is contained in:
@@ -58,7 +58,6 @@ let
|
||||
|
||||
cfg = config.systemd;
|
||||
lndir = "${pkgs.buildPackages.lndir}/bin/lndir";
|
||||
systemd = cfg.package;
|
||||
in
|
||||
rec {
|
||||
|
||||
@@ -697,14 +696,7 @@ rec {
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [ serviceConfig ];
|
||||
# Default path for systemd services. Should be quite minimal.
|
||||
config.path = mkIf config.enableDefaultPath (mkAfter [
|
||||
pkgs.coreutils
|
||||
pkgs.findutils
|
||||
pkgs.gnugrep
|
||||
pkgs.gnused
|
||||
systemd
|
||||
]);
|
||||
config.path = mkIf config.enableDefaultPath (mkAfter cfg.defaultPath);
|
||||
};
|
||||
|
||||
stage1ServiceConfig = serviceConfig;
|
||||
|
||||
@@ -379,7 +379,7 @@ rec {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to append a minimal default {env}`PATH` environment variable to the service, containing common system utilities.
|
||||
Whether to append {option}`systemd.defaultPath` to the service's {env}`PATH` environment variable.
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
@@ -425,6 +425,17 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
defaultPath = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Packages appended to the {env}`PATH` environment variable of all
|
||||
system and user services.
|
||||
|
||||
Individual services can opt out by setting `enableDefaultPath = false`.
|
||||
'';
|
||||
};
|
||||
|
||||
globalEnvironment = mkOption {
|
||||
type =
|
||||
with types;
|
||||
@@ -733,6 +744,15 @@ in
|
||||
// listToAttrs (map (withName mountToUnit) cfg.mounts)
|
||||
// listToAttrs (map (withName automountToUnit) cfg.automounts);
|
||||
|
||||
# Default path for systemd services. Should be quite minimal.
|
||||
systemd.defaultPath = [
|
||||
pkgs.coreutils
|
||||
pkgs.findutils
|
||||
pkgs.gnugrep
|
||||
pkgs.gnused
|
||||
cfg.package
|
||||
];
|
||||
|
||||
# Environment of PID 1
|
||||
systemd.managerEnvironment = {
|
||||
# Doesn't contain systemd itself - everything works so it seems to use the compiled-in value for its tools
|
||||
|
||||
Reference in New Issue
Block a user