-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild
More file actions
executable file
·40 lines (29 loc) · 787 Bytes
/
Copy pathbuild
File metadata and controls
executable file
·40 lines (29 loc) · 787 Bytes
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
#!/usr/bin/env bash
set -e
pushd ~/nixos/
#Change to change box setup
BOX="$(cat .box)"
notify(){
command -v notify-send > /dev/null
if [[ $? -ne 0 ]]; then
return
else
notify-send "$@" 2>/dev/null || :
fi
}
# if git diff --quiet '*.nix' && [[ !( $1 =~ "*force*") ]] then
# echo "No changes. Exiting"
# # notify-send "No changes. Exiting"
# popd
# exit 0
# fi
#TODO: Format files
#format **
#show changes
git diff -U0 '*.nix'
echo "Starting build"
sudo nixos-rebuild switch --flake .#${BOX} &> build.log || (cat build.log | grep --color error && notify "ERROR BUILDING NIX" && exit 1)
current=$(nixos-rebuild list-generations | grep current)
git commit -am "${current}"
popd
notify -e "good build" --icon=software-update-okay