fetchurl: use __structuredAttrs = true and pass curlOptsList directly

This commit is contained in:
Yueh-Shun Li
2025-11-24 06:11:56 +08:00
parent 4535777468
commit cd13136f03
2 changed files with 7 additions and 4 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
source "$NIX_ATTRS_SH_FILE"
source $mirrorsFile source $mirrorsFile
curlVersion=$(curl -V | head -1 | cut -d' ' -f2) curlVersion=$(curl -V | head -1 | cut -d' ' -f2)
@@ -22,10 +23,10 @@ if ! [ -f "$SSL_CERT_FILE" ]; then
curl+=(--insecure) curl+=(--insecure)
fi fi
eval "curl+=($curlOptsList)" curl+=("${curlOptsList[@]}")
curl+=( curl+=(
$curlOpts ${curlOpts[*]}
$NIX_CURL_FLAGS $NIX_CURL_FLAGS
) )
+4 -2
View File
@@ -136,6 +136,7 @@ lib.extendMkDerivation {
# Passthru information, if any. # Passthru information, if any.
passthru ? { }, passthru ? { },
# Doing the download on a remote machine just duplicates network # Doing the download on a remote machine just duplicates network
# traffic, so don't do that by default # traffic, so don't do that by default
preferLocalBuild ? true, preferLocalBuild ? true,
@@ -238,6 +239,8 @@ lib.extendMkDerivation {
derivationArgs derivationArgs
// { // {
__structuredAttrs = true;
name = name =
if finalAttrs.pname or null != null && finalAttrs.version or null != null then if finalAttrs.pname or null != null && finalAttrs.version or null != null then
"${finalAttrs.pname}-${finalAttrs.version}" "${finalAttrs.pname}-${finalAttrs.version}"
@@ -297,9 +300,8 @@ lib.extendMkDerivation {
'' ''
) curlOpts; ) curlOpts;
curlOptsList = lib.escapeShellArgs curlOptsList;
inherit inherit
curlOptsList
downloadToTemp downloadToTemp
executable executable
mirrorsFile mirrorsFile