fetchCargoVendor
pkgs.rustPackages.buildRustPackages.rustPlatform.fetchCargoVendor
Functor
Docs pulled from | This Revision | 18 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.
{
name ? if args ? pname && args ? version then "${args.pname}-${args.version}" else "cargo-deps",
hash ? (throw "fetchCargoVendor requires a `hash` value to be set for ${name}"),
nativeBuildInputs ? [ ],
...
}@args:
# TODO: add asserts about pname version and name
let
vendorStaging = stdenvNoCC.mkDerivation (
{
name = "${name}-vendor-staging";
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
nativeBuildInputs = [
fetchCargoVendorUtilV2
cacert
nix-prefetch-git'
]
++ nativeBuildInputs;
buildPhase = ''
runHook preBuild
if [ -n "''${cargoRoot-}" ]; then
cd "$cargoRoot"
fi
fetch-cargo-vendor-util-v2 create-vendor-staging ./Cargo.lock "$out"
runHook postBuild
'';
strictDeps = true;
dontConfigure = true;
dontInstall = true;
dontFixup = true;
outputHash = hash;
outputHashAlgo = if hash == "" then "sha256" else null;
outputHashMode = "recursive";
}
// removeAttrs args removedArgs
);
in
runCommand "${name}-vendor"
{
inherit vendorStaging;
nativeBuildInputs = [
fetchCargoVendorUtil
cargo
replaceWorkspaceValues
];
}
''
fetch-cargo-vendor-util create-vendor "$vendorStaging" "$out"
''