-
Notifications
You must be signed in to change notification settings - Fork 74
/
switch
executable file
·113 lines (94 loc) · 2.49 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
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
#! /usr/bin/env bash
# Shows the output of every command
set +x
activate_hm() {
rm ~/.config/orage/oragerc.bak
HOME_MANAGER_BACKUP_EXT=bak result/activate
hm-changes-report
}
switch_display() {
autorandr --change
systemctl --user restart polybar.service
}
rebuild_xmonad_edp() {
nix build .#homeConfigurations.xmonad-edp.activationPackage
activate_hm
}
rebuild_xmonad_hdmi() {
nix build .#homeConfigurations.xmonad-hdmi.activationPackage
activate_hm
}
rebuild_hyprland_edp() {
nix build .#homeConfigurations.hyprland-edp.activationPackage
activate_hm
}
rebuild_hyprland_hdmi() {
nix build .#homeConfigurations.hyprland-hdmi.activationPackage
activate_hm
}
rebuild_thinkpad() {
sudo nixos-rebuild switch --flake .#thinkpad
}
rebuild_tongfang() {
# nix build .#nixosConfigurations.tongfang-amd.config.system.build.toplevel
# sudo result/bin/switch-to-configuration switch
sudo nixos-rebuild switch --flake .#tongfang-amd
}
rebuild_tongfang_vm() {
nixos-rebuild build-vm --flake .#tongfang-amd
}
restart_X() {
echo "⚠️ Restarting X11 (requires authentication) ⚠️"
systemctl restart display-manager
}
# for fresh install only
pre_home() {
echo "Creating config / cache directories..."
# Polybar logs
mkdir -p $HOME/.config/polybar/logs
touch $HOME/.config/polybar/logs/bottom.log
touch $HOME/.config/polybar/logs/top.log
# FZF cache
mkdir -p $HOME/.cache/fzf-hoogle
touch $HOME/.cache/fzf-hoogle/cache.json
# Desktop pic
mkdir -p $HOME/Pictures/
cp imgs/nixos.png $HOME/Pictures/
# Nix daemon config for normal user
mkdir -p $HOME/.config/nix
cp home/daemon.conf $HOME/.config/nix/nix.conf
}
post_home() {
# Set user's profile picture for Gnome3
echo "Setting profile picture for the accounts service"
sudo cp imgs/gvolpe.png /var/lib/AccountsService/icons/gvolpe
sudo echo "Icon=/var/lib/AccountsService/icons/gvolpe" >> /var/lib/AccountsService/users/gvolpe
# Set screenlock wallpaper
echo "Setting screen-lock wallpaper"
multilockscreen -u imgs/nixos.png
}
# end of fresh install section
case $1 in
"xmedp")
rebuild_xmonad_edp;;
"xmhdmi")
rebuild_xmonad_hdmi;;
"hpedp")
rebuild_hyprland_edp;;
"hphdmi")
rebuild_hyprland_hdmi;;
"display")
switch_display;;
"restart-x")
restart_X;;
"update-fish")
fish -c fish_update_completions;;
"thinkpad")
rebuild_thinkpad;;
"tongfang")
rebuild_tongfang;;
"vm")
rebuild_tongfang_vm;;
*)
echo "Wrong argument: look at the switch script.";;
esac