update-flake-lock/update-flake-lock.sh

23 lines
567 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then
cd "$PATH_TO_FLAKE_DIR"
fi
2022-10-12 22:58:36 +00:00
commitArg=""
2022-11-04 17:21:23 +00:00
if [[ "$COMMIT_WITH_TOKEN" != "true" ]]; then
# Commit happening in next step
commitArg="suppress"
2022-10-12 22:58:36 +00:00
fi
if [[ -n "$TARGETS" ]]; then
inputs=()
for input in $TARGETS; do
inputs+=("--update-input" "$input")
done
2022-11-04 17:21:23 +00:00
nix flake lock "${inputs[@]}" ${commitArg:+"--commit-lock-file"} --commit-lockfile-summary "$COMMIT_MSG"
else
2022-11-04 17:21:23 +00:00
nix flake update ${commitArg:+"--commit-lock-file"} --commit-lockfile-summary "$COMMIT_MSG"
fi