diff --git a/src/modules/top-level.nix b/src/modules/top-level.nix index e17d74ad3..ce108e054 100644 --- a/src/modules/top-level.nix +++ b/src/modules/top-level.nix @@ -186,16 +186,11 @@ in # - free to create as an unprivileged user across OSes default = let - runtimeEnv = builtins.getEnv "DEVENV_RUNTIME"; - hashedRoot = builtins.hashString "sha256" config.devenv.state; - # same length as git's abbreviated commit hashes shortHash = builtins.substring 0 7 hashedRoot; in - if runtimeEnv != "" - then runtimeEnv - else "${config.devenv.tmpdir}/devenv-${shortHash}"; + "${config.devenv.tmpdir}/devenv-${shortHash}"; }; tmpdir = lib.mkOption { @@ -268,6 +263,16 @@ in enterShell = '' export PS1="\[\e[0;34m\](devenv)\[\e[0m\] ''${PS1-}" + # override temp directories after "nix develop" + for var in TMP TMPDIR TEMP TEMPDIR; do + if [ -n "''${!var-}" ]; then + export "$var"=${config.devenv.tmpdir} + fi + done + if [ -n "''${NIX_BUILD_TOP-}" ]; then + unset NIX_BUILD_TOP + fi + # set path to locales on non-NixOS Linux hosts ${lib.optionalString (pkgs.stdenv.isLinux && (pkgs.glibcLocalesUtf8 != null)) '' if [ -z "''${LOCALE_ARCHIVE-}" ]; then