Fix individual lockfile updates
All checks were successful
buildbot/nix-build .#checks.x86_64-linux.clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-ensure-tea-login Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-infra Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update-pr-clan Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-data-mesher Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-core-individual Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update-pr-clan-individual Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-homepage Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-create-pr Build done.
buildbot/nix-build .#checks.x86_64-linux.treefmt Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gitea Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-matrix-bot Build done.
buildbot/nix-build .#checks.x86_64-linux.package-matrix-bot Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-default Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-web01 Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-core Build done.
buildbot/nix-eval Build done.

The original update uses a syntax not supported by `nix --version`:
`1.18`
This commit is contained in:
a-kenji 2024-08-20 14:59:55 +02:00
parent 92b6881740
commit cda3428f62
2 changed files with 23 additions and 5 deletions

View File

@ -23,16 +23,25 @@ inputs=$(nix flake metadata --json | jq '.locks.nodes | keys[]' --raw-output | g
for input in $inputs;
do
target_branch="update-${input}"
echo "updating input: ${input}"
echo "checking out main"
echo "checking out: git checkout main"
git checkout main
git checkout -b "$target_branch"
echo "checking out: git checkout -b update-${input}"
export PR_TITLE="Automatic flake update - ${input} - ${today_minutes}"
export REMOTE_BRANCH="flake-update-${input}-${today}"
echo "action-ensure-tea-login"
action-ensure-tea-login
echo "action-flake-update: ${input}"
action-flake-update "$input"
echo "action-create-pr"
action-create-pr --assignees clan-bot
echo "check diff"
if git diff --quiet main.."$target_branch" --;then
echo "No lockfile changes for input: ${input}"
else
echo "action-create-pr"
action-create-pr --assignees clan-bot
fi
done

View File

@ -1,7 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
COMMIT_MSG="update flake lock - $(date --iso-8601=minutes)"
NIX_VERSION=$(nix --version)
echo "Nix version: $NIX_VERSION"
if [ -z "${*}" ];then
COMMIT_MSG="update flake lock - $(date --iso-8601=minutes)"
nix --experimental-features "nix-command flakes" \
flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG" "$@"
flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
else
# Support for ancient nix versions
COMMIT_MSG="update flake lock - ${*} - $(date --iso-8601=minutes)"
nix --experimental-features "nix-command flakes" \
flake lock --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG" --update-input "${@}"
fi