-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·50 lines (39 loc) · 1.19 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
#!/bin/bash
set -e
source ./config/bash/functions
function setup_linux {
# Install ansible & plugins
have ansible || sudo dnf install ansible -y
[ -d ~/.ansible/collections/ansible_collections/community ] ||
ansible-galaxy collection install community.general
# Run Ansible
ansible-playbook -i ./ansible/hosts ./ansible/linux.yml --ask-become-pass
}
function setup_macos {
sudo whoami
# Install nix
if ! have "nix-build"; then
curl -L https://nixos.org/nix/install | sh
# Workaround for https://github.com/LnL7/nix-darwin/issues/149
sudo rm /etc/nix/nix.conf
fi
# Install homebrew
if ! have brew; then
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o /tmp/brew-install.sh
NONINTERACTIVE=1 sudo -u $USERNAME bash /tmp/brew-install.sh
fi
# Set up nix-darwin
/nix/var/nix/profiles/default/bin/nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake './nix-darwin#hnbnh'
}
function main() {
if [ "$(uname)" == "Darwin" ]; then
install_dots
setup_macos
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
setup_linux
else
echo "Unsupported OS"
exit 1
fi
}
main