about summary refs log tree commit diff
path: root/pkgs/by-name/un/unipicker/package.nix
blob: 5f0bca5ef9629785cb1af924eea929d58aabf439 (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
{
  stdenv,
  fetchFromGitHub,
  lib,
  fzf,
  xclip,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "unipicker";
  version = "2.0.1";

  src = fetchFromGitHub {
    owner = "jeremija";
    repo = "unipicker";
    rev = "v${finalAttrs.version}";
    hash = "sha256-Br9nCK5eWoSN1i4LM2F31B62L9vuN5KzjS9pC9lq9oM=";
  };

  buildInputs = [
    fzf
    xclip
  ];

  preInstall = ''
    substituteInPlace unipicker \
      --replace-fail "/etc/unipickerrc" "$out/etc/unipickerrc" \
      --replace-fail "fzf" "${fzf}/bin/fzf"
    substituteInPlace unipickerrc \
      --replace-fail "/usr/local" "$out" \
      --replace-fail "fzf" "${fzf}/bin/fzf"
  '';

  makeFlags = [
    "PREFIX=${placeholder "out"}"
    "DESTDIR=${placeholder "out"}"
  ];

  meta = {
    description = "A CLI utility for searching unicode characters by description and optionally copying them to clipboard";
    homepage = "https://github.com/jeremija/unipicker";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ sigmanificient ];
    platforms = lib.platforms.unix;
    mainProgram = "unipicker";
  };
})