update-flake-lock/update-flake-lock.sh
xgroleau🐢 b55ee105d9 feat: Added nix option
fix: nix options position

Use empty list


fix options
2023-03-29 11:11:22 -07:00

24 lines
570 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then
cd "$PATH_TO_FLAKE_DIR"
fi
options=()
if [[ -n "$NIX_OPTIONS" ]]; then
for option in $NIX_OPTIONS; do
options+=("${option}")
done
fi
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