From 383370f78220d86f1bdd6f312ac6a648263b7dad Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 3 Aug 2009 12:44:45 +0000 Subject: [PATCH] * Don't create a temporary file in $HOME. svn path=/nixos/branches/modular-nixos/; revision=16561 --- modules/installer/tools/nixos-rebuild.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/installer/tools/nixos-rebuild.sh b/modules/installer/tools/nixos-rebuild.sh index 99da4e1431a2..cd2329416ab7 100644 --- a/modules/installer/tools/nixos-rebuild.sh +++ b/modules/installer/tools/nixos-rebuild.sh @@ -81,6 +81,10 @@ if test "$action" = dry-run; then fi +tmpDir=$(mktemp -t -d nixos-rebuild.XXXXXX) +trap 'rm -rf "$tmpDir"' EXIT + + # If the Nix daemon is running, then use it. This allows us to use # the latest Nix from Nixpkgs (below) for expression evaluation, while # still using the old Nix (via the daemon) for actual store access. @@ -109,10 +113,10 @@ fi # current one. Of course, the same goes for Nixpkgs, but Nixpkgs is # more conservative. if test -n "$buildNix"; then - if ! nix-build $NIXOS -A nixFallback -o $HOME/nix-tmp; then - nix-build $NIXPKGS -A nixUnstable -o $HOME/nix-tmp + if ! nix-build $NIXOS -A nixFallback -o $tmpDir/nix; then + nix-build $NIXPKGS -A nixUnstable -o $tmpDir/nix fi - PATH=$HOME/nix-tmp/bin:$PATH + PATH=$tmpDir/nix/bin:$PATH fi @@ -145,6 +149,3 @@ active system configuration may be garbage collected! This may render the system inoperable (though a reboot will fix things). EOF fi - - -rm -f $HOME/nix-tmp