Skip to content

Commit

Permalink
Update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
alapshin committed Nov 24, 2023
1 parent b8122e5 commit 3456be1
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,49 @@ secret_files=(
"secrets/accounts.json"
)

function reset() {
function reset {
for f in "${secret_files[@]}"; do
git restore "${f}"
done;

}

function encrypt() {
function encrypt {
for f in "${secret_files[@]}"; do
sops --encrypt --in-place "${f}"
done;
}

function decrypt() {
function decrypt {
for f in "${secret_files[@]}"; do
sops --decrypt --in-place "${f}"
done;
}

function check() {
function check {
decrypt
nix flake check
}

function switch() {
nixos-rebuild "${command}" --use-remote-sudo --flake "${flake_uri}"
function update {
nix flake update
}

trap reset EXIT
function rebuild {
decrypt
sudo nixos-rebuild switch --flake "${flake_uri}"
}

decrypt
trap reset EXIT

case $command in
check)
check
;;
switch)
switch
rebuild)
rebuild
;;
update)
update
;;
esac

0 comments on commit 3456be1

Please sign in to comment.