aboutsummaryrefslogtreecommitdiffhomepage
path: root/bootstrap
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-09-07 02:38:53 +0900
committernsfisis <nsfisis@gmail.com>2023-09-07 02:38:53 +0900
commit6a7baab2da521c9564a2408d60d885816f1a1be6 (patch)
tree59f49a19f231182c1d1ec86c04222bf3c7c85e30 /bootstrap
parent53bd8c469f6d7129658badd92f02d91496ff5647 (diff)
downloaddotfiles-6a7baab2da521c9564a2408d60d885816f1a1be6.tar.gz
dotfiles-6a7baab2da521c9564a2408d60d885816f1a1be6.tar.zst
dotfiles-6a7baab2da521c9564a2408d60d885816f1a1be6.zip
mitamae: introduce mitamae to provision
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap130
1 files changed, 29 insertions, 101 deletions
diff --git a/bootstrap b/bootstrap
index ab78d8c..628234f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,113 +1,41 @@
#!/bin/sh
+MITAMAE_VERSION=v1.14.0
+
+usage() {
+ echo "Usage: $0 <host>"
+ echo "Availabel hosts:"
+ find mitamae -name 'node.*.json' | sed -e 's#^mitamae/node[.]##' -e 's#.json##' | sort | sed -e 's/^/ * /'
+}
+
+# Check arguments.
if [ $# != 1 ]; then
- echo "Usage: $0 <host>" >&2
- echo "Availabel hosts:" >&2
- grep '= mkHomeConfiguration' flake.nix | cut -d '=' -f 1 | sed -e 's/^ */ * /' >&2
+ usage >&2
exit 1
fi
+target_host="$1"
+if [ ! -f "mitamae/node.${target_host}.json" ]; then
+ usage >&2
+ exit 1
+fi
+target_arch="$(grep targetArch "mitamae/node.${target_host}.json" | sed -e 's/.*: "//' -e 's/",//')"
-export XDG_CONFIG_HOME="$HOME/.config"
-export XDG_CACHE_HOME="$HOME/.cache"
-export XDG_DATA_HOME="$HOME/.local/share"
-export XDG_STATE_HOME="$HOME/.local/state"
-
-for dir in \
- "$XDG_CONFIG_HOME" \
- "$XDG_CACHE_HOME" \
- "$XDG_DATA_HOME" \
- "$XDG_STATE_HOME" \
- ; \
-do
- if [ ! -d "$dir" ]; then
- mkdir -p "$dir"
- fi
-done
+# Prepare directory.
if [ ! -d .bootstrap ]; then
mkdir .bootstrap
fi
-if [ ! -f .bootstrap/nix-install ]; then
- curl -o .bootstrap/nix-install -L https://nixos.org/nix/install
-fi
-if [ ! -d /nix ]; then
- sh .bootstrap/nix-install --daemon
- hash -r
-fi
-if ! grep -q "nix-command flakes" /etc/nix/nix.conf; then
- echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf > /dev/null
-fi
-if [ ! -d "$HOME/.local/state/nix/profiles" ]; then
- mkdir -p "$HOME/.local/state/nix/profiles"
-fi
-if ! type home-manager > /dev/null 2>&1; then
- nix run "nixpkgs#home-manager" -- switch --flake ".#$1"
-fi
-# These dotfiles are not managed by home-manager.
-for name in \
- .vimrc \
- .zshenv \
- .zshrc \
- ; \
-do
- if [ ! -L ~/"$name" ]; then
- ln -s -f ~/dotfiles/"$name" ~/"$name"
- fi
-done
-for name in \
- alacritty \
- git \
- nvim \
- ; \
-do
- if [ ! -L ~/.config/"$name" ]; then
- ln -s -f ~/dotfiles/.config/"$name" ~/.config/"$name"
- fi
-done
-
-# Go
-for name in \
- gitalias/git-extract-issue \
- gitalias/git-sw \
- ; \
-do
- src_file="src/$name.go"
- bin_file="bin/$name"
- if [ "$bin_file" -ot "$src_file" ]; then
- go build -o "$bin_file" "$src_file"
- fi
-done
-if [ ! -d ~/bin ]; then
- mkdir ~/bin
-fi
-if [ ! -d ~/bin/gitalias ]; then
- mkdir ~/bin/gitalias
+# Install mitamae.
+if [ ! -f .bootstrap/mitamae.tar.gz ]; then
+ curl -L -o .bootstrap/mitamae.tar.gz \
+ "https://github.com/itamae-kitchen/mitamae/releases/download/${MITAMAE_VERSION}/mitamae-${target_arch}.tar.gz"
fi
-for name in \
- tmux-pane-idx \
- gitalias/git-extract-issue \
- gitalias/git-sw \
- ; \
-do
- if [ ! -L ~/bin/"$name" ]; then
- ln -s -f ~/dotfiles/bin/"$name" ~/bin/"$name"
- fi
-done
-if [ ! -f ~/.config/alacritty/alacritty.local.yml ]; then
- if [ "$(uname)" = "Darwin" ]; then
- ln -s -f ~/.config/alacritty/alacritty.macos.yml ~/.config/alacritty/alacritty.local.yml
- else
- ln -s -f ~/.config/alacritty/alacritty.linux.yml ~/.config/alacritty/alacritty.local.yml
- fi
-fi
-if [ ! -d ~/.config/skk ]; then
- mkdir ~/.config/skk
-fi
-if [ ! -f ~/.config/skk/jisyo.L ]; then
- _compressed_jisyo="$(mktemp)"
- curl -fL -o "$_compressed_jisyo" https://skk-dev.github.io/dict/SKK-JISYO.L.unannotated.gz
- gunzip -cd "$_compressed_jisyo" > ~/.config/skk/jisyo.L
-fi
-if [ ! -d "$XDG_STATE_HOME/zsh" ]; then
- mkdir -p "$XDG_STATE_HOME/zsh"
+if [ ! -f .bootstrap/mitamae ]; then
+ tar xf .bootstrap/mitamae.tar.gz -C .bootstrap
+ mv ".bootstrap/mitamae-${target_arch}" .bootstrap/mitamae
fi
+
+# Run mitamae.
+.bootstrap/mitamae local \
+ --node-json "mitamae/node.${target_host}.json" \
+ mitamae/default.rb