2022-09-09 14:08:57 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, libgit2
|
|
|
|
, openssl
|
|
|
|
, stdenv
|
|
|
|
, Security
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "cargo-generate";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "0.17.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-09-09 14:08:57 +00:00
|
|
|
owner = "cargo-generate";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "cargo-generate";
|
|
|
|
rev = "v${version}";
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "sha256-7F6Pqq/iFmI3JzDKoMmSyVm6BUr+Ev9GPidOofcLNV4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
# patch Cargo.toml to not vendor libgit2 and openssl
|
|
|
|
cargoPatches = [ ./no-vendor.patch ];
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
cargoSha256 = "sha256-kC8BGobS1iMq+vIwE24Lip+HGdVnA/NjHFAb6cqOz44=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
buildInputs = [ libgit2 openssl ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ Security ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d) USER=nixbld
|
|
|
|
git config --global user.name Nixbld
|
|
|
|
git config --global user.email nixbld@localhost.localnet
|
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Exclude some tests that don't work in sandbox:
|
|
|
|
# - favorites_default_to_git_if_not_defined: requires network access to github.com
|
|
|
|
# - should_canonicalize: the test assumes that it will be called from the /Users/<project_dir>/ folder on darwin variant.
|
2022-11-04 12:27:35 +00:00
|
|
|
checkFlags = [
|
2022-11-21 17:40:18 +00:00
|
|
|
"--skip=favorites::favorites_default_to_git_if_not_defined"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
"--skip=git::utils::should_canonicalize"
|
|
|
|
];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-11-21 17:40:18 +00:00
|
|
|
description = "A tool to generaet a new Rust project by leveraging a pre-existing git repository as a template";
|
2022-09-09 14:08:57 +00:00
|
|
|
homepage = "https://github.com/cargo-generate/cargo-generate";
|
|
|
|
changelog = "https://github.com/cargo-generate/cargo-generate/blob/v${version}/CHANGELOG.md";
|
|
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
|
|
|
maintainers = with maintainers; [ figsoda turbomack ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|