From b55ee105d9e59ffde57d75b70fd970f02b734ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?xgroleau=F0=9F=90=A2?= Date: Tue, 28 Mar 2023 16:38:02 -0400 Subject: [PATCH] feat: Added nix option fix: nix options position Use empty list fix options --- action.yml | 5 +++++ update-flake-lock.sh | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index fbc2f0b..4acef75 100644 --- a/action.yml +++ b/action.yml @@ -95,6 +95,10 @@ inputs: description: 'GPG Private Key Passphrase for the GPG Private Key with which to sign the commits in the PR to be created' required: false default: '' + nix-options: + description: 'A space-separated list of options to pass to the nix command' + required: false + default: '' outputs: pull-request-number: description: 'The number of the opened pull request' @@ -146,6 +150,7 @@ runs: GIT_AUTHOR_EMAIL: ${{ env.GIT_AUTHOR_EMAIL }} GIT_COMMITTER_NAME: ${{ env.GIT_COMMITTER_NAME }} GIT_COMMITTER_EMAIL: ${{ env.GIT_COMMITTER_EMAIL }} + NIX_OPTIONS: ${{ inputs.nix-options }} TARGETS: ${{ inputs.inputs }} COMMIT_MSG: ${{ inputs.commit-msg }} PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }} diff --git a/update-flake-lock.sh b/update-flake-lock.sh index e33a199..b63d9c3 100755 --- a/update-flake-lock.sh +++ b/update-flake-lock.sh @@ -5,12 +5,19 @@ 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 flake lock "${inputs[@]}" --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG" + nix "${options[@]}" flake lock "${inputs[@]}" --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG" else - nix flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG" + nix "${options[@]}" flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG" fi