From a15736cbb0f23e74b47decc363a4cbf45850a0c4 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Oct 2017 20:01:53 +0200 Subject: quote: init --- shell.nix | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'shell.nix') diff --git a/shell.nix b/shell.nix index c9b197a26..6448c1586 100644 --- a/shell.nix +++ b/shell.nix @@ -143,18 +143,6 @@ let ''} ''); - # usage: quote [ARGS...] - cmds.quote = pkgs.writeDash "cmds.quote" '' - set -efu - prefix= - for x; do - y=$(${pkgs.jq}/bin/jq -nr --arg x "$x" '$x | @sh "\(.)"') - echo -n "$prefix$y" - prefix=' ' - done - echo - ''; - init.env = pkgs.writeText "init.env" /* sh */ '' export quiet export system @@ -243,6 +231,7 @@ in pkgs.stdenv.mkDerivation { fi export PATH=${lib.makeBinPath [ pkgs.populate + pkgs.quote shell.cmdspkg ]} -- cgit v1.2.3 From 19839ff2d8c3c4278a19b343bd0b18fe9a5e0388 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Oct 2017 20:17:27 +0200 Subject: shell: proxy call original cmdline remotely --- shell.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'shell.nix') diff --git a/shell.nix b/shell.nix index 6448c1586..53b0f964a 100644 --- a/shell.nix +++ b/shell.nix @@ -20,7 +20,7 @@ let set -efu . ${init.env} - . ${init.proxy opts} + . ${init.proxy "deploy" opts} # Use system's nixos-rebuild, which is not self-contained export PATH=/run/current-system/sw/bin @@ -55,7 +55,7 @@ let # TODO inline prepare.sh? fi - . ${init.proxy opts} + . ${init.proxy "install" opts} # Reset PATH because we need access to nixos-install. # TODO provide nixos-install instead of relying on prepare.sh @@ -93,7 +93,7 @@ let export dummy_secrets=true . ${init.env} - . ${init.proxy opts} + . ${init.proxy "test" opts} exec ${utils.build} config.system.build.toplevel ''); @@ -159,7 +159,7 @@ let export target_local="$(echo $target_object | ${pkgs.jq}/bin/jq -r .local)" ''; - init.proxy = opts: pkgs.writeText "init.proxy" /* sh */ '' + init.proxy = command: opts: pkgs.writeText "init.proxy" /* sh */ '' if \test "''${using_proxy-}" != true; then source=$(get-source "$source_file") @@ -182,7 +182,8 @@ let opts )} \ using_proxy=true \ - $(quote "$0" "$@") + ${lib.shell.escape command} \ + $WITHGETOPT_ORIG_ARGS \ ")" fi fi -- cgit v1.2.3