From f859b89525e7867f82a5c9310a479c5d4d14dd57 Mon Sep 17 00:00:00 2001 From: legendofmiracles Date: Fri, 20 Aug 2021 09:02:11 -0600 Subject: [PATCH 1/2] weylus: init at 0.11.2 --- pkgs/applications/graphics/weylus/default.nix | 55 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 57 insertions(+) create mode 100644 pkgs/applications/graphics/weylus/default.nix diff --git a/pkgs/applications/graphics/weylus/default.nix b/pkgs/applications/graphics/weylus/default.nix new file mode 100644 index 000000000000..da4f26d3eb1d --- /dev/null +++ b/pkgs/applications/graphics/weylus/default.nix @@ -0,0 +1,55 @@ +{ lib +, dbus +, stdenv +, ffmpeg +, gst_all_1 +, xorg +, libdrm +, libva +, fetchzip +, copyDesktopItems +, fontconfig +, libpng +, autoPatchelfHook +}: + +stdenv.mkDerivation rec { + pname = "weylus"; + version = "0.11.2"; + + src = fetchzip { + url = "https://github.com/H-M-H/Weylus/releases/download/v${version}/linux.zip"; + sha256 = "sha256-coA8qUpUgRjVBF/0LZgimx61fTTpdck/AO6e+r2uNu0="; + stripRoot = false; + }; + + installPhase = '' + install -Dm755 ./weylus $out/bin/weylus + copyDesktopItems ./weylus.desktop + ''; + + buildInputs = [ + libpng + dbus + libdrm + fontconfig + libva + gst_all_1.gst-plugins-base + # autoPatchelfHook complains if these are missing, even on wayland + xorg.libXft + xorg.libXinerama + xorg.libXcursor + xorg.libXrandr + xorg.libXcomposite + xorg.libXtst + ]; + + nativeBuildInputs = [ copyDesktopItems autoPatchelfHook ]; + + meta = with lib; { + description = "Use your tablet as graphic tablet/touch screen on your computer"; + homepage = "https://github.com/H-M-H/Weylus"; + license = with licenses; [ agpl3Only ]; + maintainers = with maintainers; [ legendofmiracles ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 099a151cd263..0341102f13c9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -879,6 +879,8 @@ with pkgs; weidu = callPackage ../tools/games/weidu { }; + weylus = callPackage ../applications/graphics/weylus { }; + gfshare = callPackage ../tools/security/gfshare { }; gobgp = callPackage ../tools/networking/gobgp { }; From 525846372100f5c43a0fd27866995ab89d05fc2e Mon Sep 17 00:00:00 2001 From: legendofmiracles Date: Wed, 1 Sep 2021 20:20:00 -0600 Subject: [PATCH 2/2] nixos/weylus: init --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/weylus.nix | 47 +++++++++++++++++++ pkgs/applications/graphics/weylus/default.nix | 5 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/programs/weylus.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 196eba87e13b..892c448fe073 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -199,6 +199,7 @@ ./programs/vim.nix ./programs/wavemon.nix ./programs/waybar.nix + ./programs/weylus.nix ./programs/wireshark.nix ./programs/wshowkeys.nix ./programs/xfs_quota.nix diff --git a/nixos/modules/programs/weylus.nix b/nixos/modules/programs/weylus.nix new file mode 100644 index 000000000000..ea92c77e7c32 --- /dev/null +++ b/nixos/modules/programs/weylus.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.weylus; +in +{ + options.programs.weylus = with types; { + enable = mkEnableOption "weylus"; + + openFirewall = mkOption { + type = bool; + default = false; + description = '' + Open ports needed for the functionality of the program. + ''; + }; + + users = mkOption { + type = listOf str; + default = [ ]; + description = '' + To enable stylus and multi-touch support, the user you're going to use must be added to this list. + These users can synthesize input events system-wide, even when another user is logged in - untrusted users should not be added. + ''; + }; + + package = mkOption { + type = package; + default = pkgs.weylus; + defaultText = "pkgs.weylus"; + description = "Weylus package to install."; + }; + }; + config = mkIf cfg.enable { + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [ 1701 9001 ]; + }; + + hardware.uinput.enable = true; + + users.groups.uinput.members = cfg.users; + + environment.systemPackages = [ cfg.package ]; + }; +} diff --git a/pkgs/applications/graphics/weylus/default.nix b/pkgs/applications/graphics/weylus/default.nix index da4f26d3eb1d..54b86c09341e 100644 --- a/pkgs/applications/graphics/weylus/default.nix +++ b/pkgs/applications/graphics/weylus/default.nix @@ -1,7 +1,6 @@ { lib , dbus , stdenv -, ffmpeg , gst_all_1 , xorg , libdrm @@ -24,8 +23,12 @@ stdenv.mkDerivation rec { }; installPhase = '' + runHook preInstall + install -Dm755 ./weylus $out/bin/weylus copyDesktopItems ./weylus.desktop + + runHook postInstall ''; buildInputs = [