-
Notifications
You must be signed in to change notification settings - Fork 0
/
rebuild.sh
executable file
·32 lines (25 loc) · 846 Bytes
/
rebuild.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
#!/usr/bin/env bash
username="qazer2687"
reponame="dotfiles"
mkdir -p /tmp/rebuild/ && cd /tmp/rebuild
# darwin-rebuild
if [ "$(uname)" == "Darwin" ]; then
# build system configuration
darwin-rebuild build --flake github:$username/$reponame#$(hostname) --refresh --option eval-cache false 2>/tmp/rebuild/log
# supress output unless an error occurs
if [ $? -ne 0 ]; then
cat /tmp/rebuild/log
else
nvd diff /run/current-system /tmp/rebuild/result
fi
# nixos-rebuild
elif [ "$(uname)" == "Linux" ]; then
# build system configuration
sudo nixos-rebuild build --flake github:$username/$reponame#$(hostname) --refresh --option eval-cache false 2>/tmp/rebuild/log
# supress output unless an error occurs
if [ $? -ne 0 ]; then
cat /tmp/rebuild/log
else
nvd diff /run/current-system /tmp/rebuild/result
fi
fi