-
Notifications
You must be signed in to change notification settings - Fork 2
/
nix-setup.sh
executable file
·49 lines (34 loc) · 1.13 KB
/
nix-setup.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
#!/usr/bin/env bash
#**Run as sudo**
# --- Core ---
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;36m'
NC='\033[0m' # No Color
function error {
printf "${RED}$@${NC}\n"
}
function success {
printf "${GREEN}$@${NC}\n"
}
function warn {
printf "${YELLOW}$@${NC}\n"
}
function info {
printf "${BLUE}$@${NC}\n"
}
# --- Script start ---
echo $(info "Backing up current configuration.nix and hardware-configuration.nix to `~/backup`")
mkdir -p $(pwd -P)/nixos/backup
sudo cp /etc/nixos/configuration.nix $(pwd -P)/backup/configuration.nix
sudo cp /etc/nixos/hardware-configuration.nix $(pwd -P)/backup/hardware-configuration.nix
echo $(info "Creating Symlinks...")
sudo rm -rf /etc/nixos/configuration.nix
sudo rm -rf /etc/nixos/hardware-configuration.nix
sudo ln -s "$(pwd -P)"/nixos/configuration.nix /etc/nixos/configuration.nix
sudo ln -s "$(pwd -P)"/nixos/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
echo $(success "Done!")
echo $(info "Run sudo nixos-rebuild switch to apply changes")
echo $(info "Installing riff for rust development")
nix profile install github:DeterminateSystems/riff