-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-zaneyos.sh
executable file
·133 lines (93 loc) · 3.97 KB
/
install-zaneyos.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
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
130
131
132
133
#!/usr/bin/env bash
if [ -n "$(cat /etc/os-release | grep -i nixos)" ]; then
echo "Verified this is NixOS."
echo "-----"
else
echo "This is not NixOS or the distribution information is not available."
exit
fi
if command -v git &> /dev/null; then
echo "Git is installed, continuing with installation."
else
echo "Git is not installed. Please install Git and try again."
echo "Example: nix-shell -p git"
exit 1
fi
echo "-----"
echo "Ensure In Home Directory"
cd
echo "-----"
backupname=$(date "+%Y-%m-%d-%H-%M-%S")
if [ -d "zaneyos" ]; then
echo "ZaneyOS exists, backing up to .config/zaneyos-backups folder."
if [ -d ".config/zaneyos-backups" ]; then
echo "Moving current version of ZaneyOS to backups folder."
mv $HOME/zaneyos .config/zaneyos-backups/$backupname
sleep 1
else
echo "Creating the backups folder & moving ZaneyOS to it."
mkdir .config/zaneyos-backups
mv $HOME/zaneyos .config/zaneyos-backups/$backupname
sleep 1
fi
else
echo "Thank you for choosing ZaneyOS."
echo "I hope you find your time here enjoyable!"
fi
echo "-----"
echo "Cloning & Entering ZaneyOS Repository"
git clone https://gitlab.com/zaney/zaneyos.git
cd zaneyos
echo "-----"
read -p "Enter Your New Username: " userName
sed -i "/^\s*username[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$userName\"/" ./options.nix
echo "The password for a new user is password"
sleep 2
echo "-----"
read -p "Enter Your New Hostname: " hostName
sed -i "/^\s*hostname[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$hostName\"/" ./options.nix
echo "-----"
read -p "Enter Your New Git Username [Can Be Full Name]: " gitUserName
sed -i "/^\s*gitUsername[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$gitUserName\"/" ./options.nix
echo "-----"
read -p "Enter Your New Git Email: " gitEmail
sed -i "/^\s*gitEmail[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$gitEmail\"/" ./options.nix
echo "-----"
read -p "Enter Your Locale, Example> en_US.UTF-8 : " locale
sed -i "/^\s*theLocale[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$locale\"/" ./options.nix
echo "-----"
read -p "Enter Your Keyboard Layout, Example> us : " kbdLayout
sed -i "/^\s*theKBDLayout[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$kbdLayout\"/" ./options.nix
echo "-----"
read -p "Enter Your Timezone, Example> America/New_York : " timezone
escaped_timezone=$(echo "$timezone" | sed 's/\//\\\//g')
sed -i "/^\s*theTimezone[[:space:]]*=[[:space:]]*\"/s#\"\(.*\)\"#\"$escaped_timezone\"#" ./options.nix
echo "-----"
read -p "Enter Your Desired Browser, Example> firefox : " browser
sed -i "/^\s*browser[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$browser\"/" ./options.nix
echo "-----"
read -p "Enable Animated Borders, ONLY true OR false : " animBorder
sed -i "/^\s*borderAnim[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$animBorder\"/" ./options.nix
echo "-----"
read -p "Install Kdenlive, ONLY true OR false : " kdenlive
sed -i "/^\s*kdenlive[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$kdenlive\"/" ./options.nix
echo "-----"
read -p "Enable Printer Support, ONLY true OR false : " printers
sed -i "/^\s*printer[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$printers\"/" ./options.nix
echo "-----"
read -p "Enable Flatpak Support, ONLY true OR false : " flatpaks
sed -i "/^\s*flatpak[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$flatpaks\"/" ./options.nix
echo "-----"
echo "Valid options include amd, intel, and vm"
read -p "Enter Your CPU Type : " cpuType
sed -i "/^\s*cpuType[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$cpuType\"/" ./options.nix
echo "-----"
echo "Valid options include amd, intel, nvidia, vm, intel-nvidia"
read -p "Enter Your GPU Type : " gpuType
sed -i "/^\s*gpuType[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$gpuType\"/" ./options.nix
echo "Generating The Hardware Configuration"
sudo nixos-generate-config --show-hardware-config > hardware.nix
echo "-----"
echo "Now Going To Build ZaneyOS, 🤞"
NIX_CONFIG="experimental-features = nix-command flakes"
sudo nixos-rebuild switch --flake .#$hostName