Skip to content

Commit dcb39b4

Browse files
committed
setup env variables
1 parent 98c211e commit dcb39b4

5 files changed

Lines changed: 19 additions & 6 deletions

File tree

home/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
./neovim
1010
./packages.nix
1111
./rust.nix
12+
./xdg.nix
1213
];
1314

1415
# session vars point LOCALE_ARCHIVE at i18n.glibcLocales; the default

home/go.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
home.packages = [ pkgs.go ];
44

55
programs.fish.shellInit = ''
6-
set --global --export GOPATH "$HOME/go"
6+
set --global --export GOPATH "$HOME/.local/share/go"
77
fish_add_path --global --move --path "$GOPATH/bin"
88
'';
99
}

home/neovim/options.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
swapfile = false;
2222
backup = false;
23-
undodir.__raw = ''os.getenv("HOME") .. "/.vim/undodir"'';
23+
undodir.__raw = ''vim.fn.stdpath("state") .. "/undo"'';
2424
undofile = true;
2525

2626
termguicolors = true;
@@ -33,7 +33,7 @@
3333
# plugins expect the state dirs at setup time (neo-tree opens its log there).
3434
extraConfigLuaPre = ''
3535
vim.fn.mkdir(vim.fn.stdpath("data"), "p")
36-
vim.fn.mkdir(os.getenv("HOME") .. "/.vim/undodir", "p")
36+
vim.fn.mkdir(vim.fn.stdpath("state") .. "/undo", "p")
3737
'';
3838

3939
extraConfigLua = ''

home/rust.nix

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
home.packages = [ pkgs.rustup ];
44

55
programs.fish.shellInit = ''
6-
fish_add_path --global --move --path "$HOME/.cargo/bin"
7-
if test -e "$HOME/.cargo/env.fish"
8-
source "$HOME/.cargo/env.fish"
6+
set --global --export CARGO_HOME "$HOME/.local/share/cargo"
7+
set --global --export RUSTUP_HOME "$HOME/.local/share/rustup"
8+
fish_add_path --global --move --path "$CARGO_HOME/bin"
9+
if test -e "$CARGO_HOME/env.fish"
10+
source "$CARGO_HOME/env.fish"
911
end
1012
'';
1113
}

home/xdg.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{ ... }:
2+
{
3+
# XDG base dirs — define with the spec defaults if the session hasn't.
4+
programs.fish.shellInit = ''
5+
set --query XDG_CONFIG_HOME; or set --global --export XDG_CONFIG_HOME "$HOME/.config"
6+
set --query XDG_CACHE_HOME; or set --global --export XDG_CACHE_HOME "$HOME/.cache"
7+
set --query XDG_DATA_HOME; or set --global --export XDG_DATA_HOME "$HOME/.local/share"
8+
set --query XDG_STATE_HOME; or set --global --export XDG_STATE_HOME "$HOME/.local/state"
9+
'';
10+
}

0 commit comments

Comments
 (0)