From ac36a08bf217a967968f72fe9c5621a2d77bac46 Mon Sep 17 00:00:00 2001 From: magic_rb Date: Mon, 23 Oct 2023 22:18:15 +0200 Subject: [PATCH] Fix nix wrapper usage with git locked inputs Signed-off-by: magic_rb --- flake.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index c5e499c..ce4179f 100644 --- a/flake.nix +++ b/flake.nix @@ -249,16 +249,26 @@ i="0" flake=0 + immutable=0 + + for arg in "$@" ; do + if [[ "$arg" =~ "^git+file://.*$" ]] ; then + immutable=1 + fi + done for arg in "$@" ; do case "$arg" in - build|eval) + build|eval|run) new_args[$i]="$arg" new_args[$(($i + 1))]="--reference-lock-file" new_args[$(($i + 2))]="flake-secret.lock" - new_args[$(($i + 3))]="--output-lock-file" - new_args[$(($i + 4))]="flake-secret.lock" - i="$(($i + 5))" + if [[ "$immutable" != 0 ]] ; then + new_args[$(($i + 3))]="--output-lock-file" + new_args[$(($i + 4))]="flake-secret.lock" + i="$(($i + 2))" + fi + i="$(($i + 3))" ;; flake) new_args[$i]="$arg"