about summary refs log tree commit diff
path: root/pkgs/by-name/th/thud/package.nix
blob: 5a4d3f68b2a584dfff7836ccf577fe1fb64506ba (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
{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, nix-update-script
}:

rustPlatform.buildRustPackage rec {
  pname = "thud";
  version = "0.3.1";

  src = fetchFromGitHub {
    owner = "donovanglover";
    repo = "thud";
    rev = version;
    hash = "sha256-BmrJaZ1IKXjx4/QkBDZyXvTTaalfEOKsBp9ZCW8px7I=";
  };

  cargoHash = "sha256-rmVVdes7GuGV+ClqJGxNIrs7oSwe8/ZHFD6OfP/UW7A=";

  nativeBuildInputs = [
    installShellFiles
  ];

  postInstall = ''
    install -Dm644 assets/thud.thumbnailer $out/share/thumbnailers/thud.thumbnailer
    substituteInPlace $out/share/thumbnailers/thud.thumbnailer --replace "thud" "$out/bin/thud"

    installManPage target/man/thud.1

    installShellCompletion --cmd thud \
      --bash <(cat target/completions/thud.bash) \
      --fish <(cat target/completions/thud.fish) \
      --zsh <(cat target/completions/_thud)
  '';

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

  meta = with lib; {
    description = "Generate directory thumbnails for GTK-based file browsers from images inside them";
    homepage = "https://github.com/donovanglover/thud";
    license = licenses.mit;
    maintainers = with maintainers; [ donovanglover ];
    mainProgram = "thud";
  };
}