Unverified Commit 689380e0 authored by Yueh-Shun Li's avatar Yueh-Shun Li Committed by GitHub
Browse files

fetchurl, fetchgit: use `__structuredAttrs = true` and pass `curlOptsList` and...

fetchurl, fetchgit: use `__structuredAttrs = true` and pass `curlOptsList` and `sparseCheckout` as lists (#464475)
parents f69387af 982cafd8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
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
Original line number Diff line number Diff line
@@ -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;