nixos/systemd: allow disabling the path default for services (#482045)

This commit is contained in:
Will Fancher 2026-02-10 01:03:13 +00:00 committed by GitHub
commit 999004c3c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 11 deletions

View file

@ -688,17 +688,19 @@ rec {
};
};
stage2ServiceConfig = {
imports = [ serviceConfig ];
# Default path for systemd services. Should be quite minimal.
config.path = mkAfter [
pkgs.coreutils
pkgs.findutils
pkgs.gnugrep
pkgs.gnused
systemd
];
};
stage2ServiceConfig =
{ 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
]);
};
stage1ServiceConfig = serviceConfig;

View file

@ -379,6 +379,14 @@ rec {
'';
};
enableDefaultPath = mkOption {
default = true;
type = types.bool;
description = ''
Whether to append a minimal default {env}`PATH` environment variable to the service, containing common system utilities.
'';
};
serviceConfig = mkOption {
default = { };
example = {