]> git.scottworley.com Git - auto-upgrade-with-pinch/blobdiff - modules/auto-upgrade.nix
When becoming other users, cd to / with pushd, not sudo -D
[auto-upgrade-with-pinch] / modules / auto-upgrade.nix
index a80aa5cdf56fe51ebdfedee0bdcf5e0f4ab3c608..0977176a8176855b4521ef60dc7b875062fda921 100644 (file)
@@ -183,8 +183,10 @@ let
         # Build
         in_tmpdir hydrate ${config.system.build.nixos-rebuild}/bin/nixos-rebuild build
         while read user;do
+          pushd /
           hydrate /run/wrappers/bin/sudo -u "$user" \
             ${pkgs.nix}/bin/nix-build --no-out-link '<nixpkgs>' -A "$(userenv_query "$user" .package)"
+          popd
         done < <( config_query '.userEnvironments | keys []' )
 
         # Install