Merge pull request #75 from meck/fix_xdg_data_dirs_flake

This commit is contained in:
Jörg Thalheim 2021-03-19 21:27:47 +00:00 committed by GitHub
commit 912b847b4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,6 +112,8 @@ use_flake() {
local old_tmpdir=${TMPDIR:-__UNSET__}
local old_temp=${TEMP:-__UNSET__}
local old_tempdir=${TEMPDIR:-__UNSET__}
local old_xdg_data_dirs=${XDG_DATA_DIRS:-}
# TODO: maybe use `_nix_import_env()` here: https://github.com/nix-community/nix-direnv/pull/75#issuecomment-803139886
eval "$(< "$profile_rc")"
# nix print-env-dev will create a temporary directory and use it a TMPDIR,
# we cannot rely on this directory beeing not deleted at some point,
@ -125,6 +127,7 @@ use_flake() {
_nix_export_or_unset TMPDIR "$old_tmpdir"
_nix_export_or_unset TEMP "$old_temp"
_nix_export_or_unset TEMPDIR "$old_tempdir"
export XDG_DATA_DIRS=$XDG_DATA_DIRS${old_xdg_data_dirs:+":"}$old_xdg_data_dirs
}
_nix_extract_direnv() {