-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·59 lines (49 loc) · 1.82 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
58
59
#!/bin/bash
# cd into script's folder
cd "$(cd "$(dirname "$0")" && pwd)" || exit
pwd > .configuration-location
RED='\033[0;31m'
NC='\033[0m'
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
username=$(whoami)
export username
echo "Hello $username!"
read -r -p "Have you customized the setup to your needs? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
# Add configuration files to the appropriate path
sudo cp -r bootloader /etc/nixos
sudo cp -r hardware /etc/nixos
sudo cp -r system /etc/nixos
sudo cp .configuration-location /etc/nixos
sudo cp .nix /etc/nixos
sudo cp configuration.nix /etc/nixos
sudo cp flake.lock /etc/nixos
sudo cp flake.nix /etc/nixos
USERS=$(cut -d: -f1,3 /etc/passwd | grep -E ':[0-9]{4}$' | cut -d: -f1) # Get all users
if [ -z "$USERS" ]
then
echo "No users available to remove firefox profiles ini..."
else
while IFS= read -r user ; do
# Remove potentially generated firefox profiles ini before building the nix configuration
echo "Removing firefox profiles ini for $user..."
#sudo rm -rf /home/$user/.mozilla/firefox/profiles.ini 2> /dev/null
#sudo rm -rf /home/$user/.config/mimeapps.list 2> /dev/null
#sudo rm -rf /home/$user/.config/hypr/hyprland.conf 2> /dev/null
#sudo rm -rf /home/$user/.config/hypr/scripts/wallpaper.sh 2> /dev/null
#sudo rm -rf /home/$user/.config/sfwbar/sfwbar.config 2> /dev/null
done <<< "$USERS"
fi
# Build the configuration
sudo nixos-rebuild switch
if [ -f "$HOME/.nix-successful-build" ]; then
echo "Nix generation was successful!"
bash system/scripts/reboot.sh
fi
else
printf "You really should:
- Edit .nix, configuration.nix and comment out anything you do not want to setup.
- Edit mounts.nix or disable it.$RED$BOLD An invalid mounts.nix configuration can break your system!$NC$NORMAL\n"
fi