Merge pull request #323620 from Kranzes/crate2nix

crate2nix: {0.14.0 -> 0.14.1, rewrite expression}
This commit is contained in:
Ilan Joselevich
2024-07-01 03:55:12 +03:00
committed by GitHub
3 changed files with 68 additions and 59 deletions
+68
View File
@@ -0,0 +1,68 @@
{ 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 = pname;
rev = version;
hash = "sha256-esWhRnt7FhiYq0CcIxw9pvH+ybOQmWBfHYMtleaMhBE=";
};
sourceRoot = "${src.name}/${pname}";
cargoHash = "sha256-nQ1VUCFMmpWZWvKFbyJFIZUJ24N9ZPY8JCHWju385NE=";
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/${pname} \
--prefix PATH ":" ${
lib.makeBinPath [
cargo
nix
nix-prefetch-git
]
}
for shell in bash zsh fish
do
$out/bin/${pname} completions -s $shell
installShellCompletion ${pname}.$shell || installShellCompletion --$shell _${pname}
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
];
};
}
@@ -1,57 +0,0 @@
{ lib
, rustPlatform
, fetchFromGitHub
, makeWrapper
, cargo
, nix
, nix-prefetch-git
}:
rustPlatform.buildRustPackage rec {
pname = "crate2nix";
version = "0.14.0";
src = fetchFromGitHub {
owner = "nix-community";
repo = pname;
rev = version;
hash = "sha256-rGT3CW64cJS9nlnWPFWSc1iEa3dNZecVVuPVGzcsHe8=";
};
sourceRoot = "${src.name}/crate2nix";
cargoHash = "sha256-YoE6wrQNQcRo/yaiVpASU2VOmHCPM4pDgTejn0ovOVY=";
nativeBuildInputs = [ makeWrapper ];
# Tests use nix(1), which tries (and fails) to set up /nix/var inside the
# sandbox
doCheck = false;
postFixup = ''
wrapProgram $out/bin/crate2nix \
--suffix PATH ":" ${lib.makeBinPath [ cargo nix nix-prefetch-git ]}
rm -rf $out/lib $out/bin/crate2nix.d
mkdir -p \
$out/share/bash-completion/completions \
$out/share/zsh/vendor-completions
$out/bin/crate2nix completions -s 'bash' -o $out/share/bash-completion/completions
$out/bin/crate2nix completions -s 'zsh' -o $out/share/zsh/vendor-completions
'';
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";
license = licenses.asl20;
maintainers = with maintainers; [ kolloch cole-h ];
platforms = platforms.all;
};
}
-2
View File
@@ -16641,8 +16641,6 @@ with pkgs;
cauwugo = callPackage ../development/tools/rust/cauwugo { };
crate2nix = callPackage ../development/tools/rust/crate2nix { };
critcmp = callPackage ../development/tools/rust/critcmp { };
devspace = callPackage ../development/tools/misc/devspace { };