2022-04-03 16:26:19 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2022-09-08 02:11:56 +00:00
|
|
|
if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then
|
|
|
|
cd "$PATH_TO_FLAKE_DIR"
|
|
|
|
fi
|
|
|
|
|
2023-03-28 20:38:02 +00:00
|
|
|
options=()
|
|
|
|
if [[ -n "$NIX_OPTIONS" ]]; then
|
|
|
|
for option in $NIX_OPTIONS; do
|
|
|
|
options+=("${option}")
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2022-04-03 16:26:19 +00:00
|
|
|
if [[ -n "$TARGETS" ]]; then
|
|
|
|
inputs=()
|
|
|
|
for input in $TARGETS; do
|
|
|
|
inputs+=("--update-input" "$input")
|
|
|
|
done
|
2023-03-28 20:38:02 +00:00
|
|
|
nix "${options[@]}" flake lock "${inputs[@]}" --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
|
2022-04-03 16:26:19 +00:00
|
|
|
else
|
2023-03-28 20:38:02 +00:00
|
|
|
nix "${options[@]}" flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
|
2022-04-03 16:26:19 +00:00
|
|
|
fi
|