mirror of
https://github.com/NixOS/nix
synced 2025-07-08 19:23:54 +02:00
A setting to follow XDG Base Directory standard
XDG Base Directory is a standard for locations for storing various files. Nix has a few files which seem to fit in the standard, but currently use a custom location directly in the user's ~, polluting it: - ~/.nix-profile - ~/.nix-defexpr - ~/.nix-channels This commit adds a config option (use-xdg-base-directories) to follow the XDG spec and instead use the following locations: - $XDG_STATE_HOME/nix/profile - $XDG_STATE_HOME/nix/defexpr - $XDG_STATE_HOME/nix/channels If $XDG_STATE_HOME is not set, it is assumed to be ~/.local/state. Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> Co-authored-by: Tim Fenney <kodekata@gmail.com> Co-authored-by: pasqui23 <pasqui23@users.noreply.github.com> Co-authored-by: Artturin <Artturin@artturin.com> Co-authored-by: John Ericson <Ericson2314@Yahoo.com>
This commit is contained in:
parent
a31d7d4e5e
commit
2384d36083
16 changed files with 153 additions and 20 deletions
|
@ -12,6 +12,19 @@ nix-channel --remove xyzzy
|
|||
[ -e $TEST_HOME/.nix-channels ]
|
||||
[ "$(cat $TEST_HOME/.nix-channels)" = '' ]
|
||||
|
||||
# Test the XDG Base Directories support
|
||||
|
||||
export NIX_CONFIG="use-xdg-base-directories = true"
|
||||
|
||||
nix-channel --add http://foo/bar xyzzy
|
||||
nix-channel --list | grep -q http://foo/bar
|
||||
nix-channel --remove xyzzy
|
||||
|
||||
unset NIX_CONFIG
|
||||
|
||||
[ -e $TEST_HOME/.local/state/nix/channels ]
|
||||
[ "$(cat $TEST_HOME/.local/state/nix/channels)" = '' ]
|
||||
|
||||
# Create a channel.
|
||||
rm -rf $TEST_ROOT/foo
|
||||
mkdir -p $TEST_ROOT/foo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue