about summary refs log tree commit diff
path: root/pkgs/by-name/sn/snippetexpanderd/package.nix
blob: 7cde3eaf527a5838a103f155d65151fc3387f6c0 (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
67
68
69
{ lib
, stdenv
, buildGoModule
, fetchFromSourcehut
, makeWrapper
, scdoc
, installShellFiles
, xclip
, wl-clipboard
, xdotool
, wtype
}:

buildGoModule rec {
  pname = "snippetexpanderd";
  version = "1.0.2";

  src = fetchFromSourcehut {
    owner = "~ianmjones";
    repo = "snippetexpander";
    rev = "v${version}";
    hash = "sha256-iEoBri+NuFfLkARUBA+D/Fe9xk6PPV62N/YRqPv9C/A=";
  };

  vendorHash = "sha256-W9NkENdZRzqSAONI9QS2EI5aERK+AaPqwYwITKLwXQE=";

  proxyVendor = true;

  modRoot = "cmd/snippetexpanderd";

  nativeBuildInputs = [
    makeWrapper
    scdoc
    installShellFiles
  ];

  buildInputs = [
    xclip
    wl-clipboard
    xdotool
    wtype
  ];

  ldflags = [
    "-s"
    "-w"
    "-X 'main.version=${src.rev}'"
  ];

  postInstall = ''
    make man
    installManPage snippetexpanderd.1 snippetexpander-placeholders.5
  '';

  postFixup = ''
    # Ensure xclip/wcopy and xdotool/wtype are available for copy and paste duties.
    wrapProgram $out/bin/snippetexpanderd \
      --prefix PATH : ${lib.makeBinPath [ xclip wl-clipboard xdotool wtype ]}
  '';

  meta = {
    description = "Your little expandable text snippet helper daemon";
    homepage = "https://snippetexpander.org";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ ianmjones ];
    platforms = lib.platforms.linux;
    mainProgram = "snippetexpanderd";
  };
}