From b40cde891e2a8d9f904b57572f6475062f9da5cd Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Fri, 30 May 2025 19:14:30 +0200 Subject: [PATCH] justfile: passthru extra args with 'set positional-arguments' --- justfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/justfile b/justfile index 0486f1e..58cd357 100644 --- a/justfile +++ b/justfile @@ -1,3 +1,4 @@ +set positional-arguments # makes variables accesible as $1 $2 $@ export GUM_FILTER_HEIGHT := "15" nom := `if command -v nom >/dev/null; then echo nom; else echo nix; fi` nix_eval_opts := "--log-format raw --option warn-dirty false" @@ -5,21 +6,21 @@ nix_eval_opts := "--log-format raw --option warn-dirty false" @_default: just "$(gum choose --ordered --header "Pick a recipie..." $(just --summary --unsorted))" -check: - nix flake check --keep-going +check *_: + nix flake check --keep-going "$@" -build-machine machine=`just _a_machine`: - {{nom}} build .#nixosConfigurations.{{ machine }}.config.system.build.toplevel +build-machine machine=`just _a_machine` *_: + {{nom}} build .#nixosConfigurations.{{ machine }}.config.system.build.toplevel "${@:2}" -run-vm machine=`just _a_machine`: - nixos-rebuild build-vm --flake .#{{ machine }} +run-vm machine=`just _a_machine` *_: + nixos-rebuild build-vm --flake .#{{ machine }} "${@:2}" QEMU_NET_OPTS="hostfwd=tcp::8080-:80,hostfwd=tcp::8081-:443,hostfwd=tcp::2222-:22" ./result/bin/run-*-vm -@update-inputs: +@update-inputs *_: nix eval {{nix_eval_opts}} .#inputs --apply builtins.attrNames --json \ | jq '.[]' -r \ | gum choose --no-limit --height=15 \ - | xargs -L 1 nix flake lock --update-input + | xargs -L 1 nix flake lock --update-input "$@"