1
0
Fork 0
nixfiles/pkgs/nixfiles/nixfiles-updated-inputs.sh

39 lines
946 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
xgit() {
git -c "user.name=Flake Update Bot" -c "user.email=flake-update-bot@clerie.de" "$@"
}
NOW="$(date --utc +%Y-%m-%d-%H-%M)"
xgit status || xgit clone gitea@git.clerie.de:clerie/nixfiles.git .
echo "[!] Download changes"
xgit fetch --all
echo "[!] Chechout remote master"
xgit checkout origin/master
UPDATE_BRANCH="update-inputs-${NOW}"
echo "[!] Create branch ${UPDATE_BRANCH}"
xgit checkout -b "${UPDATE_BRANCH}"
echo "[!] Update nixpkgs"
nix flake lock --update-input nixpkgs
echo "[!] Commit changes"
xgit add flake.lock
xgit commit -m "Update nixpkgs ${NOW}" || true
echo "[!] Publish ${UPDATE_BRANCH}"
xgit push --set-upstream origin "${UPDATE_BRANCH}"
echo "[!] Merge ${UPDATE_BRANCH} into updated-inputs"
xgit checkout updated-inputs
xgit merge -s ort -X theirs "${UPDATE_BRANCH}" -m "Update from ${UPDATE_BRANCH}"
echo "[!] Publish updated-inputs"
xgit push origin updated-inputs