about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/emojipick/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/emojipick/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/misc/emojipick/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/misc/emojipick/default.nix b/nixpkgs/pkgs/applications/misc/emojipick/default.nix
new file mode 100644
index 000000000000..9c28c98bf047
--- /dev/null
+++ b/nixpkgs/pkgs/applications/misc/emojipick/default.nix
@@ -0,0 +1,71 @@
+{ stdenvNoCC
+, fetchFromGitHub
+, lib
+, python3
+, xclip
+, libnotify
+, dmenu
+, rofi
+, emojipick-use-rofi ? false
+, emojipick-copy-to-clipboard ? true
+, emojipick-show-notifications ? true
+, emojipick-print-emoji ? true
+, emojipick-font-family ? "Noto Color Emoji"
+, emojipick-font-size ? "18"
+}:
+
+let
+  boolToInt = b: if b then "1" else "0"; # Convert boolean to integer string
+in
+stdenvNoCC.mkDerivation {
+  pname = "emojipick";
+  version = "2021-01-27";
+
+  src = fetchFromGitHub {
+    owner = "thingsiplay";
+    repo = "emojipick";
+    rev = "20210127";
+    sha256 = "1kib3cyx6z9v9qw6yrfx5sklanpk5jbxjc317wi7i7ljrg0vdazp";
+  };
+
+  dontConfigure = true;
+  dontBuild = true;
+
+  # Patch configuration
+  # notify-send has to be patched in a bash file
+  postPatch = ''
+    substituteInPlace emojipick \
+      --replace "use_rofi=0" "use_rofi=${boolToInt emojipick-use-rofi}" \
+      --replace "copy_to_clipboard=1" "copy_to_clipboard=${boolToInt emojipick-copy-to-clipboard}" \
+      --replace "show_notification=1" "show_notification=${boolToInt emojipick-show-notifications}" \
+      --replace "print_emoji=1" "print_emoji=${boolToInt emojipick-print-emoji}" \
+      --replace "font_family='\"Noto Color Emoji\"'" "font_family='\"${emojipick-font-family}\"'" \
+      --replace 'font_size="18"' 'font_size="${emojipick-font-size}"' \
+      ${lib.optionalString emojipick-use-rofi "--replace 'rofi ' '${rofi}/bin/rofi '"} \
+      --replace notify-send ${libnotify}/bin/notify-send
+  '';
+
+  buildInputs = [
+    python3
+    xclip
+    libnotify
+  ] ++ (if emojipick-use-rofi then [rofi] else [dmenu]);
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin
+    cp ./emojipick $out/bin
+    cp ./emojiget.py $out/bin
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Get a selection of emojis with dmenu or rofi";
+    homepage = "https://github.com/thingsiplay/emojipick";
+    license = licenses.mit;
+    maintainers = with maintainers; [ alexnortung ];
+    platforms = platforms.linux;
+  };
+}