2023-05-29 12:29:18 -04:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
rustPlatform,
|
|
|
|
fetchFromGitHub,
|
|
|
|
installShellFiles,
|
|
|
|
stdenv,
|
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "typical";
|
2024-06-21 13:35:13 +00:00
|
|
|
version = "0.12.1";
|
2023-05-29 12:29:18 -04:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stepchowfun";
|
|
|
|
repo = "typical";
|
2025-04-08 02:51:45 -04:00
|
|
|
rev = "v${version}";
|
2024-06-21 13:35:13 +00:00
|
|
|
hash = "sha256-y7PWTzD9+rkC4wZYhecmDTa3AoWl4Tgh7QXbSK4Qq5Q=";
|
2023-05-29 12:29:18 -04:00
|
|
|
};
|
|
|
|
|
2025-01-23 08:45:31 +01:00
|
|
|
useFetchCargoVendor = true;
|
|
|
|
cargoHash = "sha256-+SnwxmNQDj6acr2nEKJkNmR5PqnTIvyMApyZOmCld2U=";
|
2023-05-29 12:29:18 -04:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export NO_COLOR=true
|
|
|
|
'';
|
|
|
|
|
2025-05-06 16:17:39 +02:00
|
|
|
patches = [
|
|
|
|
# Related to https://github.com/stepchowfun/typical/pull/501
|
2025-06-02 15:54:57 +02:00
|
|
|
# Committing a slightly different patch because the upstream one doesn't apply cleanly
|
2025-05-06 16:17:39 +02:00
|
|
|
./lifetime.patch
|
|
|
|
];
|
|
|
|
|
2023-05-29 12:29:18 -04:00
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
|
|
installShellCompletion --cmd typical \
|
|
|
|
--bash <($out/bin/typical shell-completion bash) \
|
|
|
|
--fish <($out/bin/typical shell-completion fish) \
|
|
|
|
--zsh <($out/bin/typical shell-completion zsh)
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Data interchange with algebraic data types";
|
2024-03-19 03:14:51 +01:00
|
|
|
mainProgram = "typical";
|
2023-05-29 12:29:18 -04:00
|
|
|
homepage = "https://github.com/stepchowfun/typical";
|
|
|
|
changelog = "https://github.com/stepchowfun/typical/blob/${src.rev}/CHANGELOG.md";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|