-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathx
executable file
·70 lines (65 loc) · 1.5 KB
/
x
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
#!/usr/bin/env bash
# shellcheck disable=SC1091
set -euo pipefail
function nom_build() {
local FLAKE
FLAKE="${1}"
nom build --option always-allow-substitutes true .#nixosConfigurations."${FLAKE}".config.system.build.toplevel
}
function cleanup_generations() {
sudo nix-env --delete-generations --profile /nix/var/nix/profiles/system old
nix-env --delete-generations --profile ~/.local/state/nix/profiles/home-manager old
sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch
}
ARG="${1:-nothing}"
case "${ARG}" in
chart)
nom build .#topology.x86_64-linux.config.output
;;
darwin-check)
nom build .#darwinConfigurations.Harshs-MacBook-Pro.system
;;
darwin-switch)
darwin-rebuild switch --option sandbox false --print-build-logs --flake .
;;
home-boot)
nh os boot .
;;
home-check)
nom_build ryzenbox
;;
home-switch)
nh os switch .
cleanup_generations
;;
home-test)
nh os test .
;;
melody-check)
nom_build melody
;;
melody-switch)
nh os switch .
cleanup_generations
;;
server-boot)
nh os boot .
;;
server-check)
nom_build wailord
;;
server-switch)
nh os switch .
cleanup_generations
;;
gradle-hash)
shift
VERSION="${1}"
NIX_HASH="$(nix hash to-sri --type sha256 "$(nix-prefetch-url --type sha256 https://services.gradle.org/distributions/gradle-"${VERSION}"-bin.zip)")"
printf '{ version = "%s"; hash = "%s";}' "${VERSION}" "${NIX_HASH}" >modules/nixos/profiles/desktop/gradle-version.nix
;;
*)
echo "Invalid command: ${ARG}"
exit 1
;;
esac