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