diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-10-08 12:02:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-08 12:02:12 +0000 |
commit | cdfb8a30a44056abfab2d5b2ec7b105c5e24226d (patch) | |
tree | 4a117140b51b0a57d951dd3ee3ea28c8b3d5f64b /pkgs/build-support | |
parent | 7d7030c6d5f2ed10d9ddd91199dd09b94ce5d003 (diff) | |
parent | 1b60238acd96038c0a52ee73c012194d506eb432 (diff) |
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/fetchurl/default.nix | 22 | ||||
-rw-r--r-- | pkgs/build-support/fetchzip/default.nix | 17 | ||||
-rw-r--r-- | pkgs/build-support/rust/lib/default.nix | 5 |
3 files changed, 34 insertions, 10 deletions
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index a85d53adb8292..28d2519f4232c 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -57,6 +57,10 @@ in # first element of `urls'). name ? "" + # for versioned downloads optionally take pname + version. +, pname ? "" +, version ? "" + , # SRI hash. hash ? "" @@ -130,12 +134,16 @@ let else throw "fetchurl requires a hash for fixed-output derivation: ${lib.concatStringsSep ", " urls_}"; in -stdenvNoCC.mkDerivation { - name = - if showURLs then "urls" - else if name != "" then name - else baseNameOf (toString (builtins.head urls_)); - +stdenvNoCC.mkDerivation (( + if (pname != "" && version != "") then + { inherit pname version; } + else + { name = + if showURLs then "urls" + else if name != "" then name + else baseNameOf (toString (builtins.head urls_)); + } +) // { builder = ./builder.sh; nativeBuildInputs = [ curl ] ++ nativeBuildInputs; @@ -177,4 +185,4 @@ stdenvNoCC.mkDerivation { inherit meta; passthru = { inherit url; } // passthru; -} +}) diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix index 10142134792f5..9c08276cdb9b5 100644 --- a/pkgs/build-support/fetchzip/default.nix +++ b/pkgs/build-support/fetchzip/default.nix @@ -14,6 +14,8 @@ , extraPostFetch ? "" , postFetch ? "" , name ? "source" +, pname ? "" +, version ? "" , nativeBuildInputs ? [ ] , # Allows to set the extension for the intermediate downloaded # file. This can be used as a hint for the unpackCmdHooks to select @@ -23,14 +25,23 @@ lib.warnIf (extraPostFetch != "") "use 'postFetch' instead of 'extraPostFetch' with 'fetchzip' and 'fetchFromGitHub'." -(fetchurl (let + +(let tmpFilename = if extension != null then "download.${extension}" else baseNameOf (if url != "" then url else builtins.head urls); -in { - inherit name; +in +fetchurl (( + if (pname != "" && version != "") then + { + name = "${name}-${version}"; + inherit pname version; + } + else + { inherit name; } +) // { recursiveHash = true; downloadToTemp = true; diff --git a/pkgs/build-support/rust/lib/default.nix b/pkgs/build-support/rust/lib/default.nix index 2be0c25678798..5eac208cc31ca 100644 --- a/pkgs/build-support/rust/lib/default.nix +++ b/pkgs/build-support/rust/lib/default.nix @@ -38,4 +38,9 @@ rec { if platform ? rustc.platform then builtins.toFile (toRustTarget platform + ".json") (builtins.toJSON platform.rustc.platform) else toRustTarget platform; + + # Returns true if the target is no_std + # https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421 + IsNoStdTarget = platform: let rustTarget = toRustTarget platform; in + builtins.any (t: lib.hasInfix t rustTarget) ["-none" "nvptx" "switch" "-uefi"]; } |