-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-account
executable file
·129 lines (110 loc) · 3.4 KB
/
build-account
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/zsh
set -euo pipefail
setopt EXTENDED_GLOB
set -x
if [[ $(id -u) = 0 ]]; then
echo 'do not run this as root!'
exit 1
fi
cd "$HOME"
git config --global pull.rebase false
git config --global --add push.default current
git config --global --add --bool push.autoSetupRemote true
git config --global branch.autoSetupMerge true
git config --global user.name "Liam Bowen"
git config --global user.email "[email protected]"
git config --global init.defaultBranch main
if [[ ! -d "$HOME/build-machine" ]]; then
git clone \
https://github.com/hut8/build-machine \
"$HOME/build-machine"
(cd build-machine && git remote set-url origin [email protected]:hut8/build-machine)
else
(cd "$HOME/build-machine" && git pull)
fi
mkdir -p "$HOME/.ssh"
curl https://github.com/hut8.keys > \
"$HOME/.ssh/authorized_keys"
chmod 0600 "$HOME/.ssh/authorized_keys"
# Fix SSH Agent Forwarding in tmux
if [[ ! -f "$HOME/.ssh/rc" ]]; then
echo 'Fixing SSH Agent Forwarding in tmux'
ln -f "$HOME/build-machine/sshrc" "$HOME/.ssh/rc"
chmod +x "$HOME/.ssh/rc"
fi
# Prezto
if [[ ! -d "$HOME/.zprezto" ]]; then
echo 'installing prezto'
git clone --recursive \
https://github.com/hut8/prezto.git \
"${ZDOTDIR:-$HOME}/.zprezto"
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
rm -f "${ZDOTDIR:-$HOME}/.${rcfile:t}"
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
fi
# Go
PATH="/usr/local/go/bin:$PATH"
if type go &> /dev/null;
then
go install golang.org/x/tools/gopls@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/google/gops@latest
fi
# Rust
if [[ ! -d "$HOME/.cargo" ]]; then
echo 'installing rust'
curl 'https://sh.rustup.rs' -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup component add rust-src
fi
# Mise
mkdir -p "$HOME/.config/mise"
ln -f "$HOME/build-machine/mise.toml" "$HOME/.config/mise/config.toml"
(( $+commands[mise] )) || (
cargo install mise
rehash
mise install
)
# Starship prompt
# (( $+commands[starship] )) || (
# echo "installing starship"
# [[ -d "$HOME/starship" ]] || git clone https://github.com/starship/starship
# cd "$HOME/starship"
# cargo build --release
# sudo ln -f 'target/release/starship' '/usr/local/bin/starship'
# )
# Nushell config
mkdir -p "$HOME/.config/nushell"
for f in config.nu env.nu ; do
echo "linking nushell config: $f"
ln -f "$HOME/build-machine/$f" "$HOME/.config/nushell/$f"
done
# starship config
#echo "linking starship config"
#ln -f "$HOME/build-machine/starship.toml" "$HOME/.config/starship.toml"
# Various config files to be hardlinked
for f in .sqliterc .tmux.conf .pryrc .p10k.zsh ; do
echo "linking dotfile: $f"
ln -f "$HOME/build-machine/$f" "$HOME/$f"
done
# emacs
if [[ ! -d "$HOME/.emacs.d/.git" ]]; then
echo "cloning prelude"
git clone https://github.com/hut8/prelude "$HOME/.emacs.d"
(cd "$HOME/.emacs.d"; git remote set-url origin [email protected]:hut8/prelude)
else
echo "updating prelude"
(cd "$HOME/.emacs.d"; git pull)
fi
pipx install litecli
pipx install pgcli
command -v mysql >/dev/null 2>&1 && pipx install mycli
# bat - the cat replacement
(( $+commands[bat] )) || cargo install --locked bat
# just - task runner
(( $+commands[just] )) || cargo install --locked just
# du-dust
(( $+commands[dust] )) || cargo install du-dust
# Fly.io
(( $+commands[fly] )) || (curl -L https://fly.io/install.sh | sh)