summary refs log tree commit diff
path: root/pkgs/tools/misc/daktilo/default.nix
blob: b28f3b08f8cd9bdd49ad9d176c21a47b8743b948 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
, darwin
, unixtools
, pkg-config
, alsa-lib
, xorg
}:

rustPlatform.buildRustPackage rec {
  pname = "daktilo";
  version = "0.5.0";

  src = fetchFromGitHub {
    owner = "orhun";
    repo = "daktilo";
    rev = "v${version}";
    hash = "sha256-kbJwBOUODtHdngbfa6HbbQJ0kgW6f64c0EG3y8wLymw=";
  };

  cargoHash = "sha256-u9vL2HAUgP43ZDwIEK2u/I+KUEjQsfXda03gnGJ1Krc=";

  nativeBuildInputs = [
    installShellFiles
    pkg-config
  ];

  buildInputs = [
    alsa-lib
    xorg.libX11
    xorg.libXi
    xorg.libXtst
  ] ++ lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.Security
  ];

  nativeCheckInputs = [
    unixtools.script
  ];

  postInstall = ''
    mkdir -p man completions

    OUT_DIR=man $out/bin/daktilo-mangen
    OUT_DIR=completions $out/bin/daktilo-completions

    installManPage man/daktilo.1
    installShellCompletion \
      completions/daktilo.{bash,fish} \
      --zsh completions/_daktilo

    rm $out/bin/daktilo-{completions,mangen}
  '';

  meta = with lib; {
    description = "Turn your keyboard into a typewriter";
    homepage = "https://github.com/orhun/daktilo";
    changelog = "https://github.com/orhun/daktilo/blob/${src.rev}/CHANGELOG.md";
    license = with licenses; [ asl20 mit ];
    maintainers = with maintainers; [ orhun ];
    mainProgram = "daktilo";
  };
}