From 649a6c0d70083ee43e1d0fd158fd6c802d1347b0 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 24 May 2024 17:24:11 +0530 Subject: [PATCH] add varnam-fcitx --- flake.nix | 1 + varnam-fcitx5/default.nix | 81 +++++++++++++++++++ .../remove_old_meson_options_file.patch | 9 +++ 3 files changed, 91 insertions(+) create mode 100644 varnam-fcitx5/default.nix create mode 100644 varnam-fcitx5/remove_old_meson_options_file.patch diff --git a/flake.nix b/flake.nix index ccd289a..e7e3e43 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,7 @@ packages = rec { libgovarnam = pkgs.callPackage ./govarnam/default.nix { }; varnam-cli = pkgs.callPackage ./govarnam/default.nix { cli = true; }; + fcitx5-varnam = pkgs.callPackage ./varnam-fcitx5 { inherit libgovarnam; }; }; } ); diff --git a/varnam-fcitx5/default.nix b/varnam-fcitx5/default.nix new file mode 100644 index 0000000..a7249cb --- /dev/null +++ b/varnam-fcitx5/default.nix @@ -0,0 +1,81 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, meson +, ninja +, pkg-config +, fcitx5 +, libgovarnam +}: + +stdenv.mkDerivation rec { + pname = "varnam-fcitx5"; + version = "unstable-2024-05-19"; + + src = fetchFromGitHub { + owner = "varnamproject"; + repo = "varnam-fcitx5"; + rev = "e6366e4755e21dd3a162f38f21df4e5c37c64ae2"; + hash = "sha256-E9mdA6j9VFSMQwkrfGLcHUFrF0w7zWjgt+2h4MEqkPQ="; + }; + + patches = [ + ./remove_old_meson_options_file.patch + ]; + + depsBuildBuild = [ pkg-config ]; + nativeBuildInputs = [ + cmake + pkg-config + meson + ninja + fcitx5 + libgovarnam + ]; + buildInputs = [ fcitx5 libgovarnam ]; + + configurePhase = '' + runHook preConfigure + + meson setup builddir + + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + + cd builddir + meson compile + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/lib/fcitx5 + cp src/varnamfcitx.so $out/lib/fcitx5 + + mkdir -p $out/share/fcitx5/{inputmethod,addon} + cp ${src}/src/varnamfcitx.conf $out/share/fcitx5/inputmethod + cp ${src}/src/varnamfcitx-addon.conf $out/share/fcitx5/addon/varnamfcitx.conf + + mkdir -p $out/share/icons/hicolor/48x48/apps + cp ${src}/icons/*.png $out/share/icons/hicolor/48x48/apps/ + + runHook postInstall + ''; + + mesonBuildType = "native"; + + meta = { + description = "Fcitx5 wrapper for Varnam Input Method Engine"; + homepage = "https://github.com/varnamproject/varnam-fcitx5"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ adtya ]; + mainProgram = "varnam-fcitx5"; + platforms = lib.platforms.linux; + }; +} diff --git a/varnam-fcitx5/remove_old_meson_options_file.patch b/varnam-fcitx5/remove_old_meson_options_file.patch new file mode 100644 index 0000000..4be856e --- /dev/null +++ b/varnam-fcitx5/remove_old_meson_options_file.patch @@ -0,0 +1,9 @@ +diff --git a/meson_options.txt b/meson_options.txt +deleted file mode 100644 +index fce7f59..0000000 +--- a/meson_options.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-# For older meson versions( < 1.1) +-option('varnam_debug', type: 'boolean', value: false) +\ No newline at end of file