From: Scott Worley Date: Sat, 21 Dec 2024 04:23:06 +0000 (-0800) Subject: When becoming other users, cd to / X-Git-Url: http://git.scottworley.com/auto-upgrade-with-pinch/commitdiff_plain/98604ba76ee41d5835d3f0d4ef76e7250d9f59c2 When becoming other users, cd to / When building '', nix-build checks to see if there is a file literally called '' in the current directory (why?! it doesn't use it if there is one). If it can't access the current directory to do this check, it fails with the error message: error: filesystem error: symlink_status: Permission denied [/home/alice/] So we cd to a place where it can read the current directory. --- diff --git a/modules/auto-upgrade.nix b/modules/auto-upgrade.nix index a80aa5c..f3089bd 100644 --- a/modules/auto-upgrade.nix +++ b/modules/auto-upgrade.nix @@ -183,7 +183,7 @@ let # Build in_tmpdir hydrate ${config.system.build.nixos-rebuild}/bin/nixos-rebuild build while read user;do - hydrate /run/wrappers/bin/sudo -u "$user" \ + hydrate /run/wrappers/bin/sudo -u "$user" -D / \ ${pkgs.nix}/bin/nix-build --no-out-link '' -A "$(userenv_query "$user" .package)" done < <( config_query '.userEnvironments | keys []' )