Skip to content

Commit

Permalink
Move Haskell stack to XDG_DATA_HOME
Browse files Browse the repository at this point in the history
Addresses #17
 - Changes `STACK_ROOT` to point to `XDG_DATA_HOME` in `.zshenv`
 - Updates location and linking of stack `config.yaml`

This is a breaking change for existing projects, so the best migration
is simply dropping the global cache and reinstall:
 1. Drop the old `~/.stack`
 2. Reload shell to get new `STACK_ROOT`
 3. Create new config symlink: `make links`
 4. Reinstall tools: `make haskell-tools`

Stack projects should be cleared with `stack purge` and rebuilt.
  • Loading branch information
matyama committed Apr 10, 2022
1 parent b2e491b commit 09e054f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .zshenv
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export RUSTFLAGS="-C target-cpu=native"
export RUST_BACKTRACE=1

# Haskell stack
export STACK_ROOT=${HOME}/.stack
export STACK_ROOT=${XDG_DATA_HOME}/stack

# Go lang
export GOPATH=${HOME}/go
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ ifndef TRAVIS_CONFIG_PATH
TRAVIS_CONFIG_PATH=$(XDG_CONFIG_HOME)/travis
endif

ifndef STACK_ROOT
STACK_ROOT=$(XDG_DATA_HOME)/stack
endif

ifndef SDKMAN_DIR
SDKMAN_DIR=~/.sdkman
endif
Expand Down Expand Up @@ -89,6 +93,7 @@ $(FONTS_DIR) \
$(FD_CONFIG_HOME) \
$(GOPATH) \
$(RIPGREP_CONFIG_HOME) \
$(STACK_ROOT) \
$(ZSH_CUSTOM) \
$(ZSH)/completions \
$(ZSH)/plugins/poetry \
Expand All @@ -101,7 +106,6 @@ $(FONTS_DIR) \
$(XDG_CONFIG_HOME)/nvim/vim-plug \
$(XDG_CONFIG_HOME)/pypoetry \
$(XDG_CONFIG_HOME)/zsh \
~/.stack \
~/vm \
$(CRAWL_DIR):
mkdir -p $@
Expand Down Expand Up @@ -181,6 +185,7 @@ links: \
$(BYOBU_CONFIG_DIR) \
$(FD_CONFIG_HOME) \
$(RIPGREP_CONFIG_HOME) \
$(STACK_ROOT) \
$(XDG_CONFIG_HOME)/coc \
$(XDG_CONFIG_HOME)/direnv \
$(XDG_CONFIG_HOME)/git \
Expand All @@ -189,7 +194,6 @@ links: \
$(XDG_CONFIG_HOME)/nvim/scripts \
$(XDG_CONFIG_HOME)/pypoetry \
$(XDG_CONFIG_HOME)/zsh \
~/.stack \
~/.local/bin \
$(ZSH_CUSTOM)
# END DEPS
Expand All @@ -199,7 +203,7 @@ links: \
$(CFG_DIR)/.zsh* \
$(CFG_DIR)/.zlogout
@{ \
for cfg in $$(find $(CFG_DIR)/.config $(CFG_DIR)/.stack $(CFG_DIR)/.oh-my-zsh/custom -type f -not -name '*.dconf'); do \
for cfg in $$(find $(CFG_DIR)/.config $(CFG_DIR)/.local/share $(CFG_DIR)/.oh-my-zsh/custom -type f -not -name '*.dconf'); do \
ln -svf $$cfg "$(HOME)$${cfg#$(CFG_DIR)}";\
done;\
}
Expand Down

0 comments on commit 09e054f

Please sign in to comment.