From e99ee4624af44e1fa00a5717ca0cf86e627e326d Mon Sep 17 00:00:00 2001 From: Ivar Scholten Date: Thu, 17 Mar 2022 20:54:57 +0100 Subject: [PATCH] dotnet: don't set $HOME if its already writable This fixes an issue where the setup hook would overwrite $HOME in a nix-shell. Fixes #164450, #164295 --- pkgs/development/compilers/dotnet/build-dotnet.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix index 55deb594706f..4c2464f8eeee 100644 --- a/pkgs/development/compilers/dotnet/build-dotnet.nix +++ b/pkgs/development/compilers/dotnet/build-dotnet.nix @@ -90,7 +90,10 @@ in stdenv.mkDerivation rec { ''; setupHook = writeText "dotnet-setup-hook" '' - export HOME=$(mktemp -d) # Dotnet expects a writable home directory for its configuration files + if [ ! -w "$HOME" ]; then + export HOME=$(mktemp -d) # Dotnet expects a writable home directory for its configuration files + fi + export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 # Dont try to expand NuGetFallbackFolder to disk export DOTNET_NOLOGO=1 # Disables the welcome message export DOTNET_CLI_TELEMETRY_OPTOUT=1