Skip to content

Commit

Permalink
move more things to .chezmoiexternal
Browse files Browse the repository at this point in the history
  • Loading branch information
mtaron committed Apr 25, 2024
1 parent 930cd4d commit 1d00b96
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 62 deletions.
3 changes: 3 additions & 0 deletions home/.chezmoi.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
{{ $email = promptStringOnce . "user.email" "email" $email }}
{{- end -}}

gitHub:
refreshPeriod: "15m"

data:
headless: {{ $headless }}
isGnome: {{ $isGnome }}
Expand Down
24 changes: 24 additions & 0 deletions home/.chezmoiexternal.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@
url: https://github.com/direnv/direnv/releases/download/{{ $direnv_version }}/direnv.linux-amd64
executable: true

{{ $mkcert_version := (gitHubLatestRelease "FiloSottile/mkcert").TagName -}}
.local/bin/mkcert:
type: file
url: https://github.com/FiloSottile/mkcert/releases/download/{{ $mkcert_version }}/mkcert-{{ $mkcert_version }}-linux-amd64
executable: true

{{ $pnpm_version := (gitHubLatestRelease "pnpm/pnpm").TagName -}}
.local/bin/pnpm:
type: file
url: https://github.com/pnpm/pnpm/releases/download/{{ $pnpm_version }}/pnpm-linux-x64
executable: true

{{ $pulumi_version := (gitHubLatestRelease "pulumi/pulumi").TagName -}}
.local/bin:
type: archive
url: https://github.com/pulumi/pulumi/releases/download/{{ $pulumi_version }}/pulumi-{{ $pulumi_version }}-linux-x64.tar.gz
stripComponents: 1

{{ $kubelogin_version := (gitHubLatestRelease "Azure/kubelogin").TagName -}}
.local/bin/kubelogin:
type: archive-file
url: https://github.com/Azure/kubelogin/releases/download/{{ $kubelogin_version }}/kubelogin-linux-amd64.zip
path: bin/linux_amd64/kubelogin

{{ if not .headless -}}
{{ $nerd_fonts_version := (gitHubLatestRelease "ryanoasis/nerd-fonts").TagName -}}
.local/share/fonts/monaspice:
Expand Down
4 changes: 4 additions & 0 deletions home/.chezmoiignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ files
.chezmoiscripts/linux/**
.local/share/fonts
{{- end }}

{{ if not (lookPath "pnpm") -}}
.config/zsh/completions/_pnpm
{{- end }}
2 changes: 0 additions & 2 deletions home/.chezmoiremove

This file was deleted.

21 changes: 21 additions & 0 deletions home/private_dot_config/private_zsh/completions/_pnpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#compdef pnpm
compdef _pnpm pnpm

_pnpm() {
local reply
local si=$IFS

IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" SHELL=zsh pnpm completion-server -- "${words[@]}"))
IFS=$si

if [ "$reply" = "__tabtab_complete_files__" ]; then
_files
else
_describe 'values' reply
fi
}

# don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_pnpm" ]; then
_pnpm
fi
5 changes: 1 addition & 4 deletions home/private_dot_config/private_zsh/private_dot_zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if ! zgenom saved; then
has flyctl && flyctl completion zsh > "$ZSH_COMPLETIONS/_flyctl"
has rye && rye self completion --shell zsh > "$ZSH_COMPLETIONS/_rye"
has kustomize && kustomize completion zsh > "$ZSH_COMPLETIONS/_kustomize"
has pnpm && pnpm completion zsh > "$ZSH_COMPLETIONS/_pnpm"
has kubelogin && kubelogin completion zsh > "$ZSH_COMPLETIONS/_kubelogin"
[[ -d "$ZSH_COMPLETIONS" ]] && zgenom load "$ZSH_COMPLETIONS"

zgenom save
Expand All @@ -113,9 +113,6 @@ if has dotnet; then
source "$ZSH_COMPLETIONS"/_dotnet_suggest
fi

if has pnpm; then
source "$ZSH_COMPLETIONS/_pnpm"
fi

# Azure CLI
if [[ -f /etc/bash_completion.d/azure-cli ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ alias activate='source .venv/bin/activate'
alias psudo='sudo env "PATH=$PATH"'

alias rgf='rg --files | rg'

{{- if and (lookPath "chezmoi") (lookPath "gh") }}
alias chezmoi='GITHUB_TOKEN=$(gh auth token -h github.com 2>/dev/null) chezmoi'
{{- end }}
57 changes: 1 addition & 56 deletions home/private_dot_config/private_zsh/zsh.d/install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ install-protobuf-compiler()
rm -rf "$tmp_dir"
}

# https://github.com/protocolbuffers/protobuf
# https://github.com/kubernetes-sigs/kustomize
install-kustomize()
{
rm --force "$XDG_BIN_DIR"/kustomize
Expand Down Expand Up @@ -136,18 +136,6 @@ install-azcopy()
| tar --extract --ungzip --directory "$XDG_BIN_DIR" --strip-components=1 --wildcards "*/azcopy"
}

# https://github.com/Azure/kubelogin
install-kubelogin()
{
rm --force "$XDG_BIN_DIR"/kubelogin

local tmp_dir=$(mktemp --directory)
curl --show-error --silent --fail --location "https://github.com/Azure/kubelogin/releases/latest/download/kubelogin-linux-amd64.zip" \
--output "$tmp_dir"/kubelogin.zip
unzip -j -d "$XDG_BIN_DIR" "$tmp_dir"/kubelogin.zip
rm -rf "$tmp_dir"
}

# https://github.com/Azure/azure-functions-core-tools
# Needed this because the package feed was not updated quickly enough
install-azure-function-tools()
Expand All @@ -172,19 +160,6 @@ install-azure-function-tools()
rm -rf "$tmp_dir"
}

# https://www.pulumi.com/docs/
install-pulumi()
{
rm --force "$XDG_BIN_DIR"/pulumi*

local version=$(curl --retry 3 --fail --silent --location "https://www.pulumi.com/latest-version")

curl --show-error --silent --fail \
--location "https://github.com/pulumi/pulumi/releases/latest/download/pulumi-v$version-linux-x64.tar.gz" \
--header "Accept: application/octet-stream" \
| tar --extract --ungzip --directory "$XDG_BIN_DIR" --strip-components=1
}

# https://taskfile.dev/installation/
install-task()
{
Expand Down Expand Up @@ -215,21 +190,6 @@ install-go()
go version
}

# https://pnpm.io/installation
install-pnpm()
{
export PNPM_HOME="$XDG_DATA_HOME/pnpm"

rm --force "$XDG_BIN_DIR"/pnpm

curl --show-error --silent --fail --location "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linux-x64" \
--output "$XDG_BIN_DIR"/pnpm
chmod u+x "$XDG_BIN_DIR"/pnpm

mkdir --parents "$XDG_DATA_HOME/pnpm"
pnpm --version
}

# https://rye-up.com/guide/installation/#installing-rye
install-rye()
{
Expand All @@ -256,30 +216,15 @@ install-pyenv()
ln --symbolic --force "$PYENV_ROOT/bin/pyenv" "$XDG_BIN_DIR/pyenv"
}

# https://github.com/FiloSottile/mkcert#linux
install-mkcert()
{
rm --force "$XDG_BIN_DIR"/mkcert

# sudo apt install libnss3-tools
curl --show-error --silent --fail --location "https://dl.filippo.io/mkcert/latest?for=linux/amd64" --output "$XDG_BIN_DIR"/mkcert
chmod u+x "$XDG_BIN_DIR"/mkcert
mkcert --version
}

update-tools()
{
zgenom selfupdate
has azcopy && install-azcopy
has chezmoi && chezmoi upgrade
has helm && install-helm
has k3d && install-k3d
has kubelogin && install-kubelogin
has pulumi && install-pulumi
has pyenv && pyenv update
has code && install-vs-code
has pnpm && install-pnpm
has mkcert && install-mkcert
has go && install-go
has func && install-azure-function-tools
has protoc && install-protobuf-compiler
Expand Down

0 comments on commit 1d00b96

Please sign in to comment.