about summary refs log tree commit diff
path: root/pkgs/tools/misc/twm/default.nix
blob: bb963d5d1d0e83723a180282888b1b0adad9599b (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
{ lib
, fetchFromGitHub
, stdenv
, rustPlatform
, openssl
, pkg-config
, Security
, nix-update-script
, installShellFiles
}:

rustPlatform.buildRustPackage rec {
  pname = "twm";
  version = "0.10.2";

  src = fetchFromGitHub {
    owner = "vinnymeller";
    repo = "twm";
    rev = "refs/tags/v${version}";
    hash = "sha256-qOOEeaxae7nYbvNzl3BEZkdjO69lgtGrrLS5Q7akN9U=";
  };

  cargoHash = "sha256-gJ5go9V8c97pQZICUD1ksLJhOyJXyVXAWssH3fhrRVQ=";

  nativeBuildInputs = [ pkg-config installShellFiles ];
  buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ];

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    installShellCompletion --cmd twm \
      --bash <($out/bin/twm --print-bash-completion) \
      --zsh <($out/bin/twm --print-zsh-completion) \
      --fish <($out/bin/twm --print-fish-completion)

    $out/bin/twm --print-man > twm.1
    installManPage twm.1
  '';

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Customizable workspace manager for tmux";
    homepage = "https://github.com/vinnymeller/twm";
    changelog = "https://github.com/vinnymeller/twm/releases/tag/${lib.removePrefix "refs/tags/" src.rev}";
    license = lib.licenses.mit;
    maintainers =  [ lib.maintainers.vinnymeller ];
    mainProgram = "twm";
  };
}