nixpkgs/pkgs/by-name/np/npins/package.nix
Alyssa Ross 63bff8c132
treewide: migrate to fetchCargoVendor, batch 1
Cargo 1.84.0 seems to have changed the output format of cargo vendor
again, once again invalidating fetchCargoTarball FOD hashes.  It's
time to fix this once and for all, switching across the board to
fetchCargoVendor, which is not dependent on cargo vendor's output
format.

It should be possible to reproduce this diff.  To do so, get the list
of files changed by this commit, e.g. with git diff --name-only, then
run the following two commands, each with that list of files as their
standard input:

	xargs sed -i 's/^\(. *\)\(cargoHash\)\b/\1useFetchCargoVendor = true;\n\1cargoHash/'
	cut -d / -f 4 | xargs -n 1 nix-update --version=skip

This will take a long time.  It might be possible to parallelize it
using xargs' -P option.  I haven't tested it.
2025-01-23 11:46:43 +01:00

57 lines
1.2 KiB
Nix

{
lib,
rustPlatform,
makeWrapper,
stdenv,
darwin,
callPackage,
# runtime dependencies
nix, # for nix-prefetch-url
nix-prefetch-git,
git, # for git ls-remote
}:
let
runtimePath = lib.makeBinPath [
nix
nix-prefetch-git
git
];
sources = (lib.importJSON ./sources.json).pins;
in
rustPlatform.buildRustPackage rec {
pname = "npins";
version = src.version;
src = passthru.mkSource sources.npins;
useFetchCargoVendor = true;
cargoHash = "sha256-RUtWpZYaydXzF7gcROiIr04K7+Usq9iHAQwnv3ELqLI=";
buildInputs = lib.optional stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks;
[
Security
SystemConfiguration
]
);
nativeBuildInputs = [ makeWrapper ];
# (Almost) all tests require internet
doCheck = false;
postFixup = ''
wrapProgram $out/bin/npins --prefix PATH : "${runtimePath}"
'';
meta = with lib; {
description = "Simple and convenient dependency pinning for Nix";
mainProgram = "npins";
homepage = "https://github.com/andir/npins";
license = licenses.eupl12;
maintainers = with maintainers; [ piegames ];
};
passthru.mkSource = callPackage ./source.nix { };
}