-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
executable file
·57 lines (44 loc) · 1.65 KB
/
install.sh
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
#!/bin/bash
HOSTNAME=${HOSTNAME:-buque}
if ! which -s brew; then
# Install Homebrew
echo "Brew not installed, installing now..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
if ! which -s nix; then
# Install Nix
VERSION='2.25.3'
echo "Nix not installed, installing now version ${VERSION}..."
URL="https://releases.nixos.org/nix/nix-${VERSION}/install"
CONFIGURATION="
extra-experimental-features = nix-command flakes repl-flake
extra-trusted-users = ${USER}
"
sh <(curl --location "${URL}") --daemon \
--no-channel-add \
--nix-extra-conf-file <(echo "${CONFIGURATION}")
fi
softwareupdate --install-rosetta --agree-to-license
mkdir -p "$HOME/.config/kitty"
mkdir -p "$HOME/.config/peco"
mkdir -p "$HOME/.ssh"
SCRIPT_DIR=$(dirname "$0")
sudo ln -s "$HOME/Repos/$SCRIPT_DIR/nix.conf" "/etc/nix/nix.conf"
# TODO move this to nix
ln -s "$HOME/Repos/$SCRIPT_DIR/spell" "$HOME/.config/nvim"
sudo scutil --set HostName "$HOSTNAME"
sudo scutil --set LocalHostName "$HOSTNAME"
sudo scutil --set ComputerName "$HOSTNAME"
dscacheutil -flushcache
# TODO if no nix print message indicating to reboot the shell and exit
nix build "./#darwinConfigurations.$(hostname).system"
mv /etc/nix/nix.conf /etc/nix/nix.conf.before-nix-darwin
./result/sw/bin/darwin-rebuild switch --flake "./#$(hostname)"
darwin-rebuild switch --flake "./#$(hostname)"
touch "$HOME/.zshrc_local"
# TODO
# configure right click of the magic mouse
# gpg --import secrets/g.key
# cat GITCRYPTKEY | base64 --decode > GITCRYPTK
# git-crypt unlock GITCRYPTK
# cp secrets/wt.cfg.key ~/.wakatime.cfg