1{ lib
2, rustPlatform
3, fetchFromGitHub
4, installShellFiles
5, stdenv
6}:
7
8rustPlatform.buildRustPackage rec {
9 pname = "typical";
10 version = "0.12.1";
11
12 src = fetchFromGitHub {
13 owner = "stepchowfun";
14 repo = "typical";
15 rev = "v${version}";
16 hash = "sha256-y7PWTzD9+rkC4wZYhecmDTa3AoWl4Tgh7QXbSK4Qq5Q=";
17 };
18
19 cargoHash = "sha256-U6dRk8fqhxxMbu283jvkjGMjbIOYqy9jN64M2VmdZ/g=";
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 mainProgram = "typical";
39 homepage = "https://github.com/stepchowfun/typical";
40 changelog = "https://github.com/stepchowfun/typical/blob/${src.rev}/CHANGELOG.md";
41 license = licenses.mit;
42 maintainers = with maintainers; [ figsoda ];
43 };
44}