1{ lib
2, rustPlatform
3, fetchFromGitHub
4, installShellFiles
5, stdenv
6}:
7
8rustPlatform.buildRustPackage rec {
9 pname = "typical";
10 version = "0.9.7";
11
12 src = fetchFromGitHub {
13 owner = "stepchowfun";
14 repo = "typical";
15 rev = "v${version}";
16 hash = "sha256-UoTzgYxLdlWefNLeege7+tlqWh4uzotO5EbcyqvU2Xo=";
17 };
18
19 cargoHash = "sha256-GIyvwByzNKFvEdVSLo2cxuQ7JvKRFezhyKQrWjbj7Kk=";
20
21 nativeBuildInputs = [
22 installShellFiles
23 ];
24
25 preCheck = ''
26 export NO_COLOR=true
27 '';
28
29 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
30 installShellCompletion --cmd typical \
31 --bash <($out/bin/typical shell-completion bash) \
32 --fish <($out/bin/typical shell-completion fish) \
33 --zsh <($out/bin/typical shell-completion zsh)
34 '';
35
36 meta = with lib; {
37 description = "Data interchange with algebraic data types";
38 homepage = "https://github.com/stepchowfun/typical";
39 changelog = "https://github.com/stepchowfun/typical/blob/${src.rev}/CHANGELOG.md";
40 license = licenses.mit;
41 maintainers = with maintainers; [ figsoda ];
42 };
43}