From 1da877d28c740357b3449af4bb6e34875e2e4459 Mon Sep 17 00:00:00 2001 From: Malo Bourgon Date: Mon, 29 Aug 2022 11:59:54 -0700 Subject: [PATCH] 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. --- pkgs/nix-tools/darwin-rebuild.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/nix-tools/darwin-rebuild.sh b/pkgs/nix-tools/darwin-rebuild.sh index 8952ee589..19f03c63b 100644 --- a/pkgs/nix-tools/darwin-rebuild.sh +++ b/pkgs/nix-tools/darwin-rebuild.sh @@ -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