-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch
executable file
·53 lines (45 loc) · 1.09 KB
/
switch
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
#! /usr/bin/env bash
# Shows the output of every command
set +x
activateHM() {
rm ~/.config/orage/oragerc.bak
rm -rf ~/.config/secrets
HOME_MANAGER_BACKUP_EXT=bak result/activate
hm-changes-report
}
rebuild_home_edp() {
nix build .#homeConfigurations.gvolpe-edp.activationPackage
activateHM
}
rebuild_home_hdmi() {
nix build .#homeConfigurations.gvolpe-hdmi.activationPackage
activateHM
}
rebuild_system() {
# nix build .#nixosConfigurations.tongfang-amd.config.system.build.toplevel
# sudo result/bin/switch-to-configuration switch
sudo nixos-rebuild switch --flake .#tongfang-amd
}
rebuild_vm() {
sudo nixos-rebuild build-vm --flake .#tongfang-amd
}
restart_X() {
echo "⚠️ Restarting X11 (requires authentication) ⚠️"
systemctl restart display-manager
}
case $1 in
"edp")
rebuild_home_edp;;
"hdmi")
rebuild_home_hdmi;;
"restart-x")
restart_X;;
"update-fish")
fish -c fish_update_completions;;
"system")
rebuild_system;;
"vm")
rebuild_vm;;
*)
echo "expected 'edp', 'hdmi', 'restart-x', 'update-fish', 'system' or 'vm'";;
esac