Skip to content

Commit

Permalink
Merge pull request #334 from izumin5210/izumin5210/use-aqua-on-codesp…
Browse files Browse the repository at this point in the history
…aces

refactor(codespaces): install tools with aqua
  • Loading branch information
izumin5210 authored Apr 10, 2024
2 parents 2465587 + 504b2c0 commit 35a8858
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 56 deletions.
3 changes: 3 additions & 0 deletions bin/deploy-config-files
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ mkdir -p ~/.config

# bat
./bin/ln-idempotently ./config/.config/bat ~/.config/bat

# aqua
./bin/ln-idempotently ./config/.config/aquaproj-aqua ~/.config/aquaproj-aqua
31 changes: 5 additions & 26 deletions bin/setup-codespace
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,10 @@ cd $(dirname $0)/..

apt update
apt install -y \
bat \
fzf \
ripgrep \
tig

# starship
curl -sS https://starship.rs/install.sh | sh -s -- -y

# sheldon
curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh |
bash -s -- --repo rossmacarthur/sheldon --to /usr/local/bin

# eza
curl -sfL https://github.com/eza-community/eza/releases/latest/download/eza_x86_64-unknown-linux-gnu.tar.gz | tar xz
chmod +x eza
chown root:root eza
mv eza /usr/local/bin/eza

# difft
curl -sfL https://github.com/Wilfred/difftastic/releases/download/0.57.0/difft-x86_64-unknown-linux-gnu.tar.gz | tar xz
chmod +x difft
chown root:root difft
mv difft /usr/local/bin/difft

# delta
curl -sfL https://github.com/dandavison/delta/releases/download/0.17.0/delta-0.17.0-x86_64-unknown-linux-gnu.tar.gz | tar xz
mv delta-0.17.0-x86_64-unknown-linux-gnu/delta /usr/local/bin/delta
rm -rf delta-0.17.0-x86_64-unknown-linux-gnu
# https://aquaproj.github.io/docs/products/aqua-installer#shell-script
curl -sSfL -O https://raw.githubusercontent.com/aquaproj/aqua-installer/v3.0.0/aqua-installer
echo "8299de6c19a8ff6b2cc6ac69669cf9e12a96cece385658310aea4f4646a5496d aqua-installer" | sha256sum -c
chmod +x aqua-installer
./aqua-installer
22 changes: 22 additions & 0 deletions config/.config/aquaproj-aqua/aqua.codespaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# aqua - Declarative CLI Version Manager
# https://aquaproj.github.io/
# checksum:
# enabled: true
# require_checksum: true
# supported_envs:
# - all
registries:
- type: standard
ref: v4.159.0 # renovate: depName=aquaproj/aqua-registry
packages:
- name: cli/[email protected]
- name: junegunn/[email protected]
- name: dandavison/[email protected]
- name: Wilfred/[email protected]
- name: rossmacarthur/[email protected]
- name: BurntSushi/[email protected]
- name: sharkdp/[email protected]
- name: starship/[email protected]
- name: eza-community/[email protected]
- name: neovim/[email protected]
66 changes: 36 additions & 30 deletions config/.config/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,6 @@ ulimit -n 16384
bindkey -e # emacs emulation
autoload -Uz add-zsh-hook

# Load plugins
# ================================================================
source $HOME/.config/zsh/legacy/functions.zsh
source $HOME/.config/zsh/legacy/fzf.zsh

# direnv
if type direnv > /dev/null 2>&1; then
eval "$(direnv hook zsh)"
fi

# fnm (Node.js)
if type fnm >/dev/null 2>&1; then
eval "$(fnm env --use-on-cd --log-level error)"
fi

# 1Password
if [ -d "${HOME}/.config/op/plugins.sh" ]; then
source "${HOME}/.config/op/plugins.sh"
fi

# Orbstack
if [ -f "${HOME}/.orbstack/shell/init.zsh" ]; then
source "${HOME}/.orbstack/shell/init.zsh"
fi

# Starship
eval "$(starship init zsh)"

eval "$(sheldon source)"

# Zsh options
# ================================================================
REPORTTIME=3
Expand Down Expand Up @@ -94,3 +64,39 @@ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # 補完時に大文字小

autoload -Uz compinit
compinit -C -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION

# Load plugins
# ================================================================
source $HOME/.config/zsh/legacy/functions.zsh
source $HOME/.config/zsh/legacy/fzf.zsh

# direnv
if type direnv > /dev/null 2>&1; then
eval "$(direnv hook zsh)"
fi

# fnm (Node.js)
if type fnm >/dev/null 2>&1; then
eval "$(fnm env --use-on-cd --log-level error)"
fi

# aqua
if type aqua >/dev/null 2>&1; then
source <(aqua completion zsh);
aqua install --all --only-link
fi

# 1Password
if [ -d "${HOME}/.config/op/plugins.sh" ]; then
source "${HOME}/.config/op/plugins.sh"
fi

# Orbstack
if [ -f "${HOME}/.orbstack/shell/init.zsh" ]; then
source "${HOME}/.orbstack/shell/init.zsh"
fi

# Starship
eval "$(starship init zsh)"

eval "$(sheldon source)"
5 changes: 5 additions & 0 deletions config/.config/zsh/legacy/exports.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export LANG=en_US.UTF-8

if [ "$CODESPACES" = "true" ]; then
export EDITOR="code --wait"
# use aqua.codespaces.yaml on codespaces
export AQUA_GLOBAL_CONFIG=${AQUA_GLOBAL_CONFIG:-}:${XDG_CONFIG_HOME}/aquaproj-aqua/aqua.codespaces.yaml
else
export EDITOR=nvim
fi
Expand Down Expand Up @@ -67,5 +69,8 @@ if [ -d "$HOME/.nix-profile/share/git/contrib/diff-highlight" ];then
export PATH="$HOME/.nix-profile/share/git/contrib/diff-highlight:$PATH"
fi

# aqua
export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME}/aquaproj-aqua}/bin:$PATH"

# LayerX
export GOPRIVATE=github.com/LayerXcom/
1 change: 1 addition & 0 deletions home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
pkgs.starship
pkgs.tig
pkgs.tree
(pkgs.callPackage ./pkgs/aqua.nix { })

# fonts
pkgs.hackgen-font
Expand Down
22 changes: 22 additions & 0 deletions pkgs/aqua.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ pkgs }:

pkgs.stdenv.mkDerivation {
name = "aqua";
src = pkgs.fetchurl {
url = "https://github.com/aquaproj/aqua/releases/download/v2.27.0/aqua_darwin_arm64.tar.gz";
sha256 = "sha256-z0UcCsSqi4Q7OhOyDENLLjD8dnfo4oKQcUx1Ny/q0qs=";
};

sourceRoot = ".";

installPhase = ''
mkdir -p $out/bin
cp -r aqua $out/bin
'';

meta = {
description = "Declarative CLI Version manager written in Go. Support Lazy Install, Registry, and continuous update with Renovate. CLI version is switched seamlessly";
homepage = "https://github.com/aquaproj/aqua";
license = pkgs.lib.licenses.mit;
};
}

0 comments on commit 35a8858

Please sign in to comment.