From 98604ba76ee41d5835d3f0d4ef76e7250d9f59c2 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Fri, 20 Dec 2024 20:23:06 -0800 Subject: [PATCH] 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. --- modules/auto-upgrade.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 []' ) -- 2.44.1