From 08901323a33742294826a83b18a7cda11ac3c4ad Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 25 Feb 2024 18:23:00 +0100 Subject: [PATCH] nix: Move parallelCurl to devTools This is not a with-tool, because it doesn't wrap another command. --- nix/tools/devTools.nix | 35 +++++++++++++++++++++++++++++++---- nix/tools/withTools.nix | 27 +-------------------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/nix/tools/devTools.nix b/nix/tools/devTools.nix index 5c9ed0e40..81ad03d70 100644 --- a/nix/tools/devTools.nix +++ b/nix/tools/devTools.nix @@ -2,6 +2,7 @@ , cabal-install , cachix , checkedShellScript +, curl , devCabalOptions , entr , git @@ -286,19 +287,45 @@ let ${hsieMinimalImports} graph-symbols | ${graphviz}/bin/dot -Tpng -o "$_arg_outfile" ''; + parallelCurl = + checkedShellScript + { + name = "parallel-curl"; + docs = "wrapper for using parallel curl requests on the same "; + args = [ + "ARG_POSITIONAL_SINGLE([num], [number of parallel requests])" + "ARG_POSITIONAL_SINGLE([host], [host])" + "ARG_LEFTOVERS([extra arguments for curl])" + ]; + } + '' + curl_command="${curl}/bin/curl --parallel --parallel-immediate " + curl_command+="''${_arg_leftovers[*]} " + + x=1 + while [ $x -le "$1" ] + do + curl_command+="$_arg_host " + x=$((x + 1)) + done + + eval "$curl_command" + ''; + in buildToolbox { name = "postgrest-dev"; tools = [ - watch - pushCachix check - gitHooks dumpMinimalImports - hsieMinimalImports + gitHooks hsieGraphModules hsieGraphSymbols + hsieMinimalImports + parallelCurl + pushCachix + watch ]; extra = { inherit pushCachix; }; } diff --git a/nix/tools/withTools.nix b/nix/tools/withTools.nix index 57e27476e..84c91737c 100644 --- a/nix/tools/withTools.nix +++ b/nix/tools/withTools.nix @@ -296,31 +296,6 @@ let done ''; - parallelCurl = - checkedShellScript - { - name = "parallel-curl"; - docs = "wrapper for using parallel curl requests on the same "; - args = [ - "ARG_POSITIONAL_SINGLE([num], [number of parallel requests])" - "ARG_POSITIONAL_SINGLE([host], [host])" - "ARG_LEFTOVERS([extra arguments for curl])" - ]; - } - '' - curl_command="${curl}/bin/curl --parallel --parallel-immediate " - curl_command+="''${_arg_leftovers[*]} " - - x=1 - while [ $x -le "$1" ] - do - curl_command+="$_arg_host " - x=$((x + 1)) - done - - eval "$curl_command" - ''; - withPgrst = checkedShellScript { @@ -378,7 +353,7 @@ in buildToolbox { name = "postgrest-with"; - tools = [ withPgAll withGit withPgrst withSlowPg withSlowPgrst parallelCurl ] ++ withPgVersions; + tools = [ withPgAll withGit withPgrst withSlowPg withSlowPgrst ] ++ withPgVersions; # make withTools available for other nix files extra = { inherit withGit withPg withPgAll withPgrst withSlowPg withSlowPgrst; }; }