maybe we can allow 2 or more arguments for --replace
the first argument is the search string
arguments 2 and following are the replacement string
and multiple strings are joined with \n
so this would look like
# NOTE this does not work
substituteInPlace scripts/generate.py \
--replace-fail \
"Path(\"" \
"Path(\"$out/opt/get-pip/" \
--replace-fail \
' data = requests.get(' \
' if os.getenv("GET_PIP_OFFLINE") == "1":' \
' return {Version("${pip-whl.version}"): ("${pip-whl}", "'$(sha256sum ${pip-whl} | cut -c1-64)'")}' \
' data = requests.get(' \
why?
patching with substituteInPlace is more stable than with patch files
the leading quotes for every line are needed to preserve indents
how?
this would require that all file paths come before the --replace arguments
alternatives?
lib.escapeShellArg and builtins.concatStringsSep
~~but with $'...' dollar-prefixed bash strings for special characters like newlines
see also #45~~
using substituteInPlace to replace one line with multiple lines is a bit ugly now
maybe we can allow 2 or more arguments for
--replace
the first argument is the search string arguments 2 and following are the replacement string and multiple strings are joined with\n
so this would look like
why? patching with substituteInPlace is more stable than with patch files the leading quotes for every line are needed to preserve indents
how? this would require that all file paths come before the
--replace
argumentsalternatives?
lib.escapeShellArg
andbuiltins.concatStringsSep
~~but with $'...' dollar-prefixed bash strings for special characters like newlines see also #45~~