Preserve PATH variable when using sudo
Some systems set `secure_path` in sudoers. When this is set the `PATH` variable is not set in the sudo environment. Using `--preserve-env=PATH` ensures that the PATH env var is set properly in those systems. This is similar to the issue with [darwin-rebuild](https://github.com/nix-darwin/nix-darwin/issues/798) not working with sudo on these systems.
This commit is contained in:
parent
72c88d5928
commit
300af6fcc5
1 changed files with 1 additions and 0 deletions
|
|
@ -802,6 +802,7 @@ in
|
|||
if [ -f "${cfg.brewPrefix}/brew" ]; then
|
||||
PATH="${cfg.brewPrefix}:${lib.makeBinPath [ pkgs.mas ]}:$PATH" \
|
||||
sudo \
|
||||
--preserve-env=PATH \
|
||||
--user=${escapeShellArg cfg.user} \
|
||||
--set-home \
|
||||
${cfg.onActivation.brewBundleCmd}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue