From 8409bb94bb9023c8ac510ab952908be0417ec9f3 Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Sat, 13 Mar 2021 05:21:26 +0100
Subject: [PATCH] Add squeekboard

---
 pkgs/squeekboard/1.12.0.nix  | 77 ++++++++++++++++++++++++++++++++++
 pkgs/squeekboard/default.nix | 80 ++++++++++++++++++++++++++++++++++++
 2 files changed, 157 insertions(+)
 create mode 100644 pkgs/squeekboard/1.12.0.nix
 create mode 100644 pkgs/squeekboard/default.nix

diff --git a/pkgs/squeekboard/1.12.0.nix b/pkgs/squeekboard/1.12.0.nix
new file mode 100644
index 0000000..d741df1
--- /dev/null
+++ b/pkgs/squeekboard/1.12.0.nix
@@ -0,0 +1,77 @@
+{ lib
+, stdenv
+, pkgs
+, fetchFromGitLab
+, cmake
+, meson
+, ninja
+, pkg-config
+, gnome3
+, glib
+, gtk3
+, wayland
+, wayland-protocols
+, rustc
+, cargo
+, libxml2
+, libxkbcommon
+, rustPlatform
+, makeWrapper
+, substituteAll
+, fetchpatch
+, feedbackd
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "squeekboard";
+  version = "1.12.0";
+
+  src = fetchFromGitLab {
+    domain = "source.puri.sm";
+    owner = "Librem5";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-1iQqu2pnEsSVqPYTpeC8r/BDHDTlQGYiU5xwiLlzQXQ=";
+  };
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkg-config
+    rustc
+    cargo
+    glib  # for glib-compile-resources
+    wayland
+    makeWrapper
+  ];
+
+  buildInputs = [
+    gtk3  # for gio-2.0
+    gnome3.gnome-desktop
+    wayland
+    wayland-protocols
+    libxml2
+    libxkbcommon
+    feedbackd
+  ];
+
+  cargoSha256 = "sha256-XALMnV3XShHoV3C/B/pVhlYiEiw2nfR4r6eG1KhZLDo=";
+
+  cargoUpdateHook = ''
+    cat Cargo.toml.in Cargo.deps > Cargo.toml
+  '';
+
+  # Don't use buildRustPackage phases, only use it for rust deps setup
+  configurePhase = null;
+  buildPhase = null;
+  checkPhase = null;
+  installPhase = null;
+
+  meta = with lib; {
+    description = "Squeekboard is a virtual keyboard supporting Wayland";
+    homepage = "https://source.puri.sm/Librem5/squeekboard";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ masipcat ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/squeekboard/default.nix b/pkgs/squeekboard/default.nix
new file mode 100644
index 0000000..cff3695
--- /dev/null
+++ b/pkgs/squeekboard/default.nix
@@ -0,0 +1,80 @@
+{ lib
+, stdenv
+, pkgs
+, fetchFromGitLab
+, cmake
+, meson
+, ninja
+, pkg-config
+, gnome3
+, glib
+, gtk3
+, wayland
+, wayland-protocols
+, rustc
+, cargo
+, libxml2
+, libxkbcommon
+, rustPlatform
+, makeWrapper
+, substituteAll
+, fetchpatch
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "squeekboard";
+  version = "1.9.2";
+
+  src = fetchFromGitLab {
+    domain = "source.puri.sm";
+    owner = "Librem5";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "02jjc9qxzb4iw3vypqdaxzs5mc66zkfmij1yrv72h99acg5s3ncz";
+  };
+
+  patches = [
+    # Add missing dependency 'gio-unix-2.0' to meson.build.
+    # https://source.puri.sm/Librem5/squeekboard/-/merge_requests/356
+    (fetchpatch {
+      url = "https://source.puri.sm/Librem5/squeekboard/-/merge_requests/356.patch";
+      sha256 = "1xi7h2nsrlf7szlj41kj6x1503af9svk5yj19l0q32ln3c40kgfs";
+    })
+  ];
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkg-config
+    rustc
+    cargo
+    glib  # for glib-compile-resources
+    wayland
+    makeWrapper
+  ];
+
+  buildInputs = [
+    gtk3  # for gio-2.0
+    gnome3.gnome-desktop
+    wayland
+    wayland-protocols
+    libxml2
+    libxkbcommon
+  ];
+
+  cargoSha256 = "00gzw703w16i81yna4winj7gi4w7a1p986ggnx48jvyi0c14mxx0";
+
+  # Don't use buildRustPackage phases, only use it for rust deps setup
+  configurePhase = null;
+  buildPhase = null;
+  checkPhase = null;
+  installPhase = null;
+
+  meta = with lib; {
+    description = "Squeekboard is a virtual keyboard supporting Wayland";
+    homepage = "https://source.puri.sm/Librem5/squeekboard";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ masipcat ];
+    platforms = platforms.linux;
+  };
+}
-- 
GitLab