at 23.11-pre 1.2 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.programs.weylus; 7in 8{ 9 options.programs.weylus = with types; { 10 enable = mkEnableOption (lib.mdDoc "weylus"); 11 12 openFirewall = mkOption { 13 type = bool; 14 default = false; 15 description = lib.mdDoc '' 16 Open ports needed for the functionality of the program. 17 ''; 18 }; 19 20 users = mkOption { 21 type = listOf str; 22 default = [ ]; 23 description = lib.mdDoc '' 24 To enable stylus and multi-touch support, the user you're going to use must be added to this list. 25 These users can synthesize input events system-wide, even when another user is logged in - untrusted users should not be added. 26 ''; 27 }; 28 29 package = mkOption { 30 type = package; 31 default = pkgs.weylus; 32 defaultText = lib.literalExpression "pkgs.weylus"; 33 description = lib.mdDoc "Weylus package to install."; 34 }; 35 }; 36 config = mkIf cfg.enable { 37 networking.firewall = mkIf cfg.openFirewall { 38 allowedTCPPorts = [ 1701 9001 ]; 39 }; 40 41 hardware.uinput.enable = true; 42 43 users.groups.uinput.members = cfg.users; 44 45 environment.systemPackages = [ cfg.package ]; 46 }; 47}