Files
nixpkgs/pkgs/by-name/cr/crate2nix/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

69 lines
1.6 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
makeWrapper,
cargo,
nix,
nix-prefetch-git,
installShellFiles,
}:
rustPlatform.buildRustPackage rec {
pname = "crate2nix";
version = "0.14.1";
src = fetchFromGitHub {
owner = "nix-community";
repo = "crate2nix";
rev = version;
hash = "sha256-esWhRnt7FhiYq0CcIxw9pvH+ybOQmWBfHYMtleaMhBE=";
};
sourceRoot = "${src.name}/crate2nix";
cargoHash = "sha256-Du6RAe4Ax3KK90h6pQEtF75Wdniz+IqF2/TXHA9Ytbw=";
nativeBuildInputs = [
makeWrapper
installShellFiles
];
# Tests use nix(1), which tries (and fails) to set up /nix/var inside the sandbox.
doCheck = false;
postInstall = ''
wrapProgram $out/bin/crate2nix \
--suffix PATH ":" ${
lib.makeBinPath [
cargo
nix
nix-prefetch-git
]
}
for shell in bash zsh fish
do
$out/bin/crate2nix completions -s $shell
installShellCompletion crate2nix.$shell || installShellCompletion --$shell _crate2nix
done
'';
meta = with lib; {
description = "Nix build file generator for Rust crates";
mainProgram = "crate2nix";
longDescription = ''
Crate2nix generates Nix files from Cargo.toml/lock files
so that you can build every crate individually in a Nix sandbox.
'';
homepage = "https://github.com/nix-community/crate2nix";
changelog = "https://nix-community.github.io/crate2nix/90_reference/90_changelog";
license = licenses.asl20;
maintainers = with maintainers; [
kolloch
cole-h
kranzes
];
};
}