1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-09-11 12:49:18 +03:00

Add -H to sudo nix-env [...] to deal with warning

After NixOS/nix#6676, the following warning is displayed when running
`darwin-rebuild switch`:
  warning: $HOME ('/Users/jamie') is not owned by you, falling back to the
  one defined in the 'passwd' file.
This commit is contained in:
Malo Bourgon 2022-08-29 11:59:54 -07:00
parent 2f3c9bb364
commit 1da877d28c

View File

@ -160,7 +160,7 @@ fi
if [ "$action" = list ] || [ "$action" = rollback ]; then
if [ "$USER" != root ] && [ ! -w $(dirname "$profile") ]; then
sudo nix-env -p "$profile" "${extraProfileFlags[@]}"
sudo -H nix-env -p "$profile" "${extraProfileFlags[@]}"
else
nix-env -p "$profile" "${extraProfileFlags[@]}"
fi
@ -178,7 +178,7 @@ if [ -z "$systemConfig" ]; then exit 0; fi
if [ "$action" = switch ]; then
if [ "$USER" != root ] && [ ! -w $(dirname "$profile") ]; then
sudo nix-env -p "$profile" --set "$systemConfig"
sudo -H nix-env -p "$profile" --set "$systemConfig"
else
nix-env -p "$profile" --set "$systemConfig"
fi