2022-09-09 14:08:57 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, libgit2
|
|
|
|
, openssl
|
|
|
|
, stdenv
|
2023-01-20 10:41:00 +00:00
|
|
|
, darwin
|
|
|
|
, git
|
2022-09-09 14:08:57 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "cargo-generate";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "0.18.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}";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-Prue55oe3+NeiOiOYdr41sRqc6WvAVKC9nHD0a6mvrc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
cargoSha256 = "sha256-TcJ8DeplbBOx3utdc67xkUg5Z4PYe/lnG+k/X5Zg0FQ=";
|
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
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
buildInputs = [ libgit2 openssl ] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ git ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
# disable vendored libgit2 and openssl
|
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|