query
On this page

fetchCrate

pkgs.fetchCrate

Functor
Docs pulled from | This Revision | 24 minutes ago


Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.

Noogle detected

This is a Functor

Learn about functors

Implementation

The following is the current implementation of this function.

{
  crateName ? args.pname,
  pname ? null,
  # The `dl` field of the registry's index configuration
  # https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration
  registryDl ? "https://static.crates.io/crates",
  version,
  unpack ? true,
  ...
}@args:

assert pname == null || pname == crateName;

(if unpack then fetchzip else fetchurl) (
  {
    name = "${crateName}-${version}.tar.gz";
    url = "${registryDl}/${crateName}/${version}/download";

    passthru = { inherit pname version; };
  }
  // lib.optionalAttrs unpack {
    extension = "tar.gz";
  }
  // removeAttrs args [
    "crateName"
    "pname"
    "registryDl"
    "version"
    "unpack"
  ]
)