summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2020-03-23 15:17:37 +0100
committerMichael Weiss <dev.primeos@gmail.com>2020-10-18 14:09:49 +0200
commit7c676c64297b805148d9a88bb4e7cf265bc506a0 (patch)
treed00c4656788bf2ce86ca3d2d5429a262313c332b
parent69bf6db33e7b6ccf410a9f2c2d46f51f0c89800c (diff)
downloadnixpkgs-7c676c64297b805148d9a88bb4e7cf265bc506a0.tar
nixpkgs-7c676c64297b805148d9a88bb4e7cf265bc506a0.tar.gz
nixpkgs-7c676c64297b805148d9a88bb4e7cf265bc506a0.tar.bz2
nixpkgs-7c676c64297b805148d9a88bb4e7cf265bc506a0.tar.lz
nixpkgs-7c676c64297b805148d9a88bb4e7cf265bc506a0.tar.xz
nixpkgs-7c676c64297b805148d9a88bb4e7cf265bc506a0.tar.zst
nixpkgs-7c676c64297b805148d9a88bb4e7cf265bc506a0.zip
wshowkeys: init at 2019-09-26
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/wshowkeys.nix22
-rw-r--r--pkgs/tools/wayland/wshowkeys/default.nix35
-rw-r--r--pkgs/top-level/all-packages.nix2
4 files changed, 60 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index ed6201237b3..41e0188cb71 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -172,6 +172,7 @@
   ./programs/wavemon.nix
   ./programs/waybar.nix
   ./programs/wireshark.nix
+  ./programs/wshowkeys.nix
   ./programs/x2goserver.nix
   ./programs/xfs_quota.nix
   ./programs/xonsh.nix
diff --git a/nixos/modules/programs/wshowkeys.nix b/nixos/modules/programs/wshowkeys.nix
new file mode 100644
index 00000000000..09b008af1d5
--- /dev/null
+++ b/nixos/modules/programs/wshowkeys.nix
@@ -0,0 +1,22 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.programs.wshowkeys;
+in {
+  meta.maintainers = with maintainers; [ primeos ];
+
+  options = {
+    programs.wshowkeys = {
+      enable = mkEnableOption ''
+        wshowkeys (displays keypresses on screen on supported Wayland
+        compositors). It requires root permissions to read input events, but
+        these permissions are dropped after startup'';
+    };
+  };
+
+  config = mkIf cfg.enable {
+    security.wrappers.wshowkeys.source = "${pkgs.wshowkeys}/bin/wshowkeys";
+  };
+}
diff --git a/pkgs/tools/wayland/wshowkeys/default.nix b/pkgs/tools/wayland/wshowkeys/default.nix
new file mode 100644
index 00000000000..0058d34edb6
--- /dev/null
+++ b/pkgs/tools/wayland/wshowkeys/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl
+, meson, pkg-config, wayland, ninja
+, cairo, libinput, pango, wayland-protocols, libxkbcommon
+}:
+
+let
+  version = "2019-09-26";
+  commit = "a9bf6bca0361b57c67e4627bf53363a7048457fd";
+in stdenv.mkDerivation rec {
+  pname = "wshowkeys-unstable";
+  inherit version;
+
+  src = fetchurl {
+    url = "https://git.sr.ht/~sircmpwn/wshowkeys/archive/${commit}.tar.gz";
+    sha256 = "0b21z3csd3v4lw5b8a6lpx5gfsdk0gjmm8906sa72hyfd1p39b7g";
+  };
+
+  nativeBuildInputs = [ meson pkg-config wayland ninja ];
+  buildInputs = [ cairo libinput pango wayland-protocols libxkbcommon ];
+
+  meta = with stdenv.lib; {
+    description = "Displays keys being pressed on a Wayland session";
+    longDescription = ''
+      Displays keypresses on screen on supported Wayland compositors (requires
+      wlr_layer_shell_v1 support).
+      Note: This tool requires root permissions to read input events, but these
+      permissions are dropped after startup. The NixOS module provides such a
+      setuid binary (use "programs.wshowkeys.enable = true;").
+    '';
+    homepage = "https://git.sr.ht/~sircmpwn/wshowkeys";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ primeos ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 3a15e49b650..56dca370395 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3431,6 +3431,8 @@ in
 
   wrangler = callPackage ../development/tools/wrangler { };
 
+  wshowkeys = callPackage ../tools/wayland/wshowkeys { };
+
   xkcdpass = with pythonPackages; toPythonApplication xkcdpass;
 
   xob = callPackage ../tools/X11/xob { };