about summary refs log tree commit diff
path: root/pkgs/applications/misc/wofi-emoji/default.nix
blob: 81ba584cc2464eb4f698981f6aa2a25d22ced26b (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
70
{
  stdenv,
  lib,
  fetchurl,
  fetchFromGitHub,
  jq,
  wofi,
  wtype,
  wl-clipboard,
}:

let
  emojiJSON = fetchurl {
    url = "https://raw.githubusercontent.com/muan/emojilib/v3.0.11/dist/emoji-en-US.json";
    hash = "sha256-WHqCSNgDzc6ZASdVrwPvsU4MtBcYLKDp2D2Hykrq1sI=";
  };
in
stdenv.mkDerivation rec {
  pname = "wofi-emoji";
  version = "1.0.0";

  src = fetchFromGitHub {
    owner = "Zeioth";
    repo = "wofi-emoji";
    rev = "v${version}";
    hash = "sha256-wLZK7RcDxxlYuu27WNj+SoRoBiCqk9whp4Fyg0SOoPA=";
  };

  nativeBuildInputs = [ jq ];
  buildInputs = [
    wofi
    wtype
    wl-clipboard
  ];

  postPatch = ''
    substituteInPlace build.sh \
      --replace 'curl ${emojiJSON.url}' 'cat ${emojiJSON}'
    substituteInPlace wofi-emoji \
      --replace 'wofi' '${wofi}/bin/wofi' \
      --replace 'wtype' '${wtype}/bin/wtype' \
      --replace 'wl-copy' '${wl-clipboard}/bin/wl-copy'
  '';

  buildPhase = ''
    runHook preBuild

    bash build.sh

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp wofi-emoji $out/bin

    runHook postInstall
  '';

  meta = {
    description = "Simple emoji selector for Wayland using wofi and wl-clipboard";
    homepage = "https://github.com/Zeioth/wofi-emoji";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ johnrtitor ymarkus ];
    platforms = lib.platforms.all;
    mainProgram = "wofi-emoji";
  };
}