mirror of
https://github.com/DeterminateSystems/update-flake-lock.git
synced 2025-04-20 17:00:16 +03:00

This is useful for monorepos containing multiple flakes. For example it might be desired for a nixpkgs update to happen on all sub-flakes at the same time. Added a new option `flake-dirs` allowing to specify multiple flake directories to be updated simultaneously via a single PR
34 lines
747 B
Bash
Executable file
34 lines
747 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
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
|
|
}
|
|
|
|
|
|
options=()
|
|
if [[ -n "${NIX_OPTIONS:-}" ]]; then
|
|
for option in $NIX_OPTIONS; do
|
|
options+=("${option}")
|
|
done
|
|
fi
|
|
|
|
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
|
|
else
|
|
update
|
|
fi
|