Skip to content

Commit 14250a5

Browse files
committed
containers: fix run_args for devenv.nix
1 parent b640f70 commit 14250a5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/devenv-devShell.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Options:
3232
--podman-run Execute `podman run`.
3333
' : "$@")"
3434

35+
local run_args=()
36+
eval "$(docopt_get_eval_array args '<run-args>' run_args)"
37+
3538
local registry="${args['--registry']}"
3639
local copy_args=()
3740

@@ -50,13 +53,10 @@ Options:
5053
# shellcheck disable=SC2086
5154
nix run "${app_prefix}-copy-to" -- --registry "${registry}" "${copy_args[@]}" ${args['--copy-args']}
5255
fi
53-
eval "$(docopt_get_eval_array args '<run-args>' run_args)"
5456

5557
if [[ "${args['--docker-run']}" != false ]]; then
56-
# shellcheck disable=SC2154
5758
nix run "${app_prefix}-docker-run" -- "${run_args[@]}"
5859
elif [[ "${args['--podman-run']}" != false ]]; then
59-
# shellcheck disable=SC2154
6060
nix run "${app_prefix}-podman-run" -- "${run_args[@]}"
6161
fi
6262
}

src/devenv.nix

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ pkgs.writeScriptBin "devenv" ''
116116
EOF
117117
)
118118
119+
# shellcheck disable=SC1090
120+
source "$(command -v docopts.sh)"
119121
eval "$(${pkgs.docopts}/bin/docopts -A subcommand -h "$help" : "$@")"
122+
local run_args=()
123+
eval "$(docopt_get_eval_array args '<run-args>' run_args)"
120124
121125
export DEVENV_CONTAINER=1
122126
container="''${subcommand[CONTAINER-NAME]}"
@@ -146,13 +150,9 @@ pkgs.writeScriptBin "devenv" ''
146150
fi
147151
148152
if [[ ''${subcommand[--docker-run]} != false ]]; then
149-
# shellcheck disable=SC1090
150-
source "$(command -v docopts.sh)"
151-
$($CUSTOM_NIX/bin/nix $NIX_FLAGS build --print-out-paths --no-link --impure ".#devenv.containers.\"$container\".dockerRun") -- $(docopt_get_values subcommand '<run-args>')
152-
if [[ ''${subcommand[--podman-run]} != false ]]; then
153-
# shellcheck disable=SC1090
154-
source "$(command -v docopts.sh)"
155-
$($CUSTOM_NIX/bin/nix $NIX_FLAGS build --print-out-paths --no-link --impure ".#devenv.containers.\"$container\".podmanRun") -- $(docopt_get_values subcommand '<run-args>')
153+
$($CUSTOM_NIX/bin/nix $NIX_FLAGS build --print-out-paths --no-link --impure ".#devenv.containers.\"$container\".dockerRun") -- "''${run_args[@]}"
154+
elif [[ ''${subcommand[--podman-run]} != false ]]; then
155+
$($CUSTOM_NIX/bin/nix $NIX_FLAGS build --print-out-paths --no-link --impure ".#devenv.containers.\"$container\".podmanRun") -- "''${run_args[@]}"
156156
fi
157157
;;
158158
search)

0 commit comments

Comments
 (0)