-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomatic-install
executable file
·82 lines (66 loc) · 2.9 KB
/
automatic-install
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
#!/usr/bin/env bash
clear
echo "Welcome to Guibi1's dotfiles"
echo "Looking for Nix..."
if ! command -v nix > /dev/null 2>&1; then
echo "Nix is not installed. Running the install script and exiting."
sh <(curl -fsSL https://nixos.org/nix/install) --daemon
echo "Please open a new terminal and run this script again."
echo "If nix couldn't install or w/e, here's the script to run:"
echo "sh <(curl -fsSL https://nixos.org/nix/install) --daemon"
exit 1
fi
echo "Nix is installed. Continuing with the rest of the script..."
echo ""
echo "Cloning repo..."
nix-shell -p git --run "git clone https://github.com/Guibi1/.dotfiles ~/nix-config"
cp ~/nix-config/vars.exemple.nix ~/nix-config/vars.nix
nano ~/nix-config/vars.nix
clear
echo "Vars editing complete!"
echo ""
if grep -q 'NAME=NixOS' /etc/os-release; then
echo "You are running NixOS!"
echo "Switching NixOS to unstable channel..."
sudo nix-channel --quiet --add https://nixos.org/channels/nixos-unstable nixos
sudo nix-channel --quiet --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
sudo nix-channel --update
echo "Linking config and switching..."
sudo ln -sf ~/nix-config/nixos-config.nix /etc/nixos/configuration.nix
sudo nixos-rebuild switch --upgrade
elif [[ "$(uname)" == "Darwin" ]]; then
echo "You are on MacOS!"
echo "I hope you disabled Hyprland!"
echo ""
sleep 5
echo "Adding NixDarwin channel..."
nix-channel --quiet --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
nix-channel --quiet --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
echo "Building config and switching..."
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A darwin-rebuild
./result/bin/darwin-rebuild switch -I darwin-config=$HOME/nix-config/darwin-config.nix
sudo rm -r result
else
echo "You are not on NixOS, skipping nixos-config..."
echo "I hope you disabled Hyprland!"
echo ""
sleep 5
if command -v home-manager &> /dev/null ; then
echo "Home Manager is already installed!"
else
echo "Installing Home Manager..."
nix-channel --quiet --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --quiet --update
nix-shell '<home-manager>' -A install
fi
echo ""
echo "Linking Home Manager config and switching..."
rm -rf ~/.config/home-manager
ln -sf ~/nix-config ~/.config/home-manager
export NIXPKGS_ALLOW_UNFREE=1
home-manager switch
fi
fish -c "tide configure --auto --style=Lean --prompt_colors='True color' --show_time=No --lean_prompt_height='Two lines' --prompt_connection=Dotted --prompt_connection_andor_frame_color=Dark --prompt_spacing=Sparse --icons='Few icons' --transient=Yes"
echo "All done!"
echo "You should probably reboot"