diff --git a/hosts/modules/gui/sxmo.nix b/hosts/modules/gui/sxmo.nix index e20faaf5b..d623bd6b8 100644 --- a/hosts/modules/gui/sxmo.nix +++ b/hosts/modules/gui/sxmo.nix @@ -1,5 +1,8 @@ # this work derives from noneucat's sxmo service/packages, found via NUR # - +# other nix works: +# - +# - # # sxmo documentation: # - @@ -15,10 +18,14 @@ # - list available daemons: `sxmo_daemons.sh list` # - query if a daemon is active: `sxmo_daemons.sh running ` # - start daemon: `sxmo_daemons.sh start ` +# - managable by `superctl` +# - `superctl status` # - user hooks: # - live in ~/.config/sxmo/hooks/ # - logs: # - live in ~/.local/state/sxmo.log +# - ~/.local/state/superd.log +# - ~/.local/state/superd/logs/.log # - `journalctl --user --boot` (lightm redirects the sxmo session stdout => systemd) # # - default components: @@ -31,7 +38,7 @@ with lib; let - cfg = config.sane.gui.phosh; + cfg = config.sane.gui.sxmo; in { options = { @@ -39,6 +46,38 @@ in default = false; type = types.bool; }; + sane.gui.sxmo.hooks = mkOption { + type = types.package; + default = pkgs.runCommand "sxmo-hooks" { } '' + mkdir -p $out + ln -s ${pkgs.sxmo-utils}/share/sxmo/default_hooks $out/bin + ''; + description = '' + hooks to make visible to sxmo. + a hook is a script generally of the name sxmo_hook_.sh + which is called by sxmo at key moments to proide user programmability. + ''; + }; + sane.gui.sxmo.deviceHooks = mkOption { + type = types.package; + default = pkgs.runCommand "sxmo-device-hooks" { } '' + mkdir -p $out + ln -s ${pkgs.sxmo-utils}/share/sxmo/default_hooks/unknown $out/bin + ''; + description = '' + device-specific hooks to make visible to sxmo. + this package supplies things like `sxmo_hook_inputhandler.sh`. + a hook is a script generally of the name sxmo_hook_.sh + which is called by sxmo at key moments to proide user programmability. + ''; + }; + sane.gui.sxmo.terminal = mkOption { + type = types.nullOr (types.enum [ "foot" "st" "vte" ]); + default = "st"; + description = '' + name of terminal to use for sxmo_terminal.sh + ''; + }; }; config = mkMerge [ @@ -51,7 +90,7 @@ in }; } - (mkIf config.sane.gui.sxmo.enable { + (mkIf cfg.enable { sane.programs.sxmoApps.enableFor.user.colin = true; # TODO: probably need to enable pipewire @@ -101,15 +140,37 @@ in inotify-tools libnotify lisgd + mako superd sway sxmo-utils + cfg.deviceHooks + cfg.hooks xdg-user-dirs - ]; - environment.sessionVariables.XDG_DATA_DIRS = [ - # TODO: only need the share/sxmo directly linked - "${pkgs.sxmo-utils}/share" - ]; + ] ++ lib.optionals (cfg.terminal != null) [ pkgs."${cfg.terminal}" ]; + environment.sessionVariables = { + XDG_DATA_DIRS = [ + # TODO: only need the share/sxmo directly linked + "${pkgs.sxmo-utils}/share" + ]; + # XXX: make sure the user is part of the `input` group! + SXMO_LISGD_INPUT_DEVICE = "/dev/input/by-id/usb-Wacom_Co._Ltd._Pen_and_multitouch_sensor-event-if00"; + # sxmo tries to determine device type from /proc/device-tree/compatible, + # but that doesn't seem to exist on NixOS? (or maybe it just doesn't exist + # on non-aarch64 builds). + # the device type informs (at least): + # - SXMO_WIFI_MODULE + # - SXMO_RTW_SCAN_INTERVAL + # - SXMO_SYS_FILES + # - SXMO_TOUCHSCREEN_ID + # - SXMO_MONITOR + # - SXMO_ALSA_CONTROL_NAME + # - SXMO_SWAY_SCALE + # see + # SXMO_DEVICE_NAME = "pine64,pinephone-1.2"; + } // lib.optionalAttrs (cfg.terminal != null) { + TERMCMD = lib.mkDefault (if cfg.terminal == "vte" then "vte-2.91" else cfg.terminal); + }; }) ]; }