fetchurl, fetchgit: use __structuredAttrs = true and pass curlOptsList and sparseCheckout as lists (#464475)

This commit is contained in:
Yueh-Shun Li
2025-12-11 18:25:29 +00:00
committed by GitHub
4 changed files with 19 additions and 8 deletions
+2
View File
@@ -4,6 +4,8 @@
# - revision specified and remote without HEAD
#
source "$NIX_ATTRS_SH_FILE"
echo "exporting $url (rev $rev) into $out"
runHook preFetch
+7 -1
View File
@@ -138,6 +138,8 @@ lib.makeOverridable (
derivationArgs
// {
__structuredAttrs = true;
inherit name;
builder = ./builder.sh;
@@ -243,7 +245,11 @@ lib.makeOverridable (
"FETCHGIT_HTTP_PROXIES"
];
inherit preferLocalBuild meta allowedRequisites;
outputChecks.out = {
${if allowedRequisites != null then "allowedRequisites" else null} = allowedRequisites;
};
inherit preferLocalBuild meta;
passthru = {
gitRepoUrl = url;
+3 -2
View File
@@ -1,3 +1,4 @@
source "$NIX_ATTRS_SH_FILE"
source $mirrorsFile
curlVersion=$(curl -V | head -1 | cut -d' ' -f2)
@@ -22,10 +23,10 @@ if ! [ -f "$SSL_CERT_FILE" ]; then
curl+=(--insecure)
fi
eval "curl+=($curlOptsList)"
curl+=("${curlOptsList[@]}")
curl+=(
$curlOpts
${curlOpts[*]}
$NIX_CURL_FLAGS
)
+7 -5
View File
@@ -135,6 +135,7 @@ lib.extendMkDerivation {
# Passthru information, if any.
passthru ? { },
# Doing the download on a remote machine just duplicates network
# traffic, so don't do that by default
preferLocalBuild ? true,
@@ -240,6 +241,8 @@ lib.extendMkDerivation {
derivationArgs
// {
__structuredAttrs = true;
name =
if finalAttrs.pname or null != null && finalAttrs.version or null != null then
"${finalAttrs.pname}-${finalAttrs.version}"
@@ -315,14 +318,13 @@ lib.extendMkDerivation {
''
) curlOpts;
curlOptsList = lib.escapeShellArgs curlOptsList;
inherit
showURLs
mirrorsFile
postFetch
curlOptsList
downloadToTemp
executable
mirrorsFile
postFetch
showURLs
;
impureEnvVars = impureEnvVars ++ netrcImpureEnvVars;