Skip to content

Commit

Permalink
Avoid to manage sheldon with Nix
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Jul 14, 2023
1 parent df1f34b commit df214e7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
6 changes: 2 additions & 4 deletions .config/home-manager/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@
pkgs.gnumake
pkgs.elmPackages.elm

# TODO: not yet officially supported macos, but works.
# So you should `NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 home-manager switch` in macos
# https://github.com/NixOS/nixpkgs/pull/177024/files#diff-82935a120aeca7ac66b6d3b13c94ddffb8b33c87849105f732ac59b26e7812c5R58
pkgs.sheldon
# Do not manage sheldon with nix for unsupported Darwin https://github.com/kachick/dotfiles/issues/149
# pkgs.sheldon

# Required in many asdf(rtx) plugins
pkgs.unzip
Expand Down
11 changes: 11 additions & 0 deletions .config/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
# in ~/.zshenv, executed `unsetopt GLOBAL_RCS` and ignored /etc/zshrc
[ -r /etc/zshrc ] && . /etc/zshrc

# https://github.com/kachick/dotfiles/issues/149
_install_latest_sheldon() {
mkdir -p "$XDG_DATA_HOME/sheldon/bin"
# https://github.com/rossmacarthur/sheldon/blob/e989c2f1799988104ecf2dff4e5907d54fc1d693/README.md#pre-built-binaries
# Depending external resource without any hash ... :<
curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh | bash -s -- --repo rossmacarthur/sheldon --to "$XDG_DATA_HOME/sheldon/bin"
}

sheldon --version || _install_latest_sheldon

eval "$(sheldon source)"

# zsh-history-substring-search
Expand Down Expand Up @@ -82,6 +92,7 @@ update_tools() {
nix-channel --update
home-manager switch

_install_latest_sheldon
sheldon lock --update
if command -v rtx; then
rtx self-update
Expand Down
19 changes: 11 additions & 8 deletions home/.zshenv
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
# https://qiita.com/vintersnow/items/7343b9bf60ea468a4180
# zmodload zsh/zprof && zprof

export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:=$HOME/.config}"
# Do NOT manage .zshenv(thisfile) in the dir.
export ZDOTDIR="${ZDOTDIR:=$XDG_CONFIG_HOME/zsh}"

export XDG_CACHE_HOME="$HOME/.cache"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_DATA_HOME="$HOME/.local/share"

# https://github.com/kachick/dotfiles/issues/149
path+=("$XDG_DATA_HOME/sheldon/bin")

export PATH
export MANPATH
# -U: keep only the first occurrence of each duplicated value
Expand All @@ -21,14 +32,6 @@ if [ -x /usr/libexec/path_helper ]; then
eval $(/usr/libexec/path_helper -s)
fi

export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:=$HOME/.config}"
# Do NOT manage .zshenv(thisfile) in the dir.
export ZDOTDIR="${ZDOTDIR:=$XDG_CONFIG_HOME/zsh}"

export XDG_CACHE_HOME="$HOME/.cache"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_DATA_HOME="$HOME/.local/share"

# Actually not used?
# https://wiki.archlinux.jp/index.php/XDG_Base_Directory
# https://www.reddit.com/r/zsh/comments/tpwx9t/zcompcache_vs_zcompdump/
Expand Down

0 comments on commit df214e7

Please sign in to comment.