Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid to manage sheldon with Nix #177

Merged
merged 3 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 14 additions & 0 deletions .config/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
# 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"
}

# Do NOT use (( $+commands[sheldon] )) here. It made 1.5x slower zsh execution :<
if ! type 'sheldon' > /dev/null; then
_install_latest_sheldon
fi

eval "$(sheldon source)"

# zsh-history-substring-search
Expand Down Expand Up @@ -82,6 +95,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