2023-05-16 11:09:57 +00:00
|
|
|
# this work derives from noneucat's sxmo service/packages, found via NUR
|
|
|
|
# - <repo:nix-community/nur-combined:repos/noneucat/modules/pinephone/sxmo.nix>
|
2023-05-17 06:58:37 +00:00
|
|
|
# other nix works:
|
|
|
|
# - <https://github.com/wentam/sxmo-nix>
|
2023-05-17 10:18:11 +00:00
|
|
|
# - implements sxmo atop tinydm (also packaged by wentam)
|
|
|
|
# - wentam cleans up sxmo-utils to be sealed. also patches to use systemd poweroff, etc
|
|
|
|
# - packages a handful of anjan and proycon utilities
|
|
|
|
# - packages <https://gitlab.com/kop316/mmsd/>
|
|
|
|
# - packages <https://gitlab.com/kop316/vvmd/>
|
2023-05-17 06:58:37 +00:00
|
|
|
# - <https://github.com/chuangzhu/nixpkgs-sxmo>
|
2023-05-17 10:18:11 +00:00
|
|
|
# - implements sxmo as a direct systemd service -- apparently no DM
|
|
|
|
# - packages sxmo-utils
|
|
|
|
# - injects PATH into each script
|
|
|
|
# - perhaps sxmo-utils is best packaged via the `resholve` shell solver?
|
2023-05-17 00:25:14 +00:00
|
|
|
#
|
|
|
|
# sxmo documentation:
|
|
|
|
# - <repo:anjan/sxmo-docs-next>
|
|
|
|
#
|
|
|
|
# sxmo technical overview:
|
|
|
|
# - inputs
|
|
|
|
# - dwm: handles vol/power buttons; hardcoded in config.h
|
|
|
|
# - lisgd: handles gestures
|
|
|
|
# - startup
|
|
|
|
# - daemon based (lisgsd, idle_locker, statusbar_periodics)
|
|
|
|
# - auto-started at login
|
|
|
|
# - managable by `sxmo_daemons.sh`
|
|
|
|
# - list available daemons: `sxmo_daemons.sh list`
|
|
|
|
# - query if a daemon is active: `sxmo_daemons.sh running <my-daemon>`
|
|
|
|
# - start daemon: `sxmo_daemons.sh start <my-daemon>`
|
2023-05-17 06:58:37 +00:00
|
|
|
# - managable by `superctl`
|
|
|
|
# - `superctl status`
|
2023-05-17 00:25:14 +00:00
|
|
|
# - user hooks:
|
|
|
|
# - live in ~/.config/sxmo/hooks/
|
|
|
|
# - logs:
|
|
|
|
# - live in ~/.local/state/sxmo.log
|
2023-05-17 06:58:37 +00:00
|
|
|
# - ~/.local/state/superd.log
|
|
|
|
# - ~/.local/state/superd/logs/<daemon>.log
|
2023-05-17 00:25:14 +00:00
|
|
|
# - `journalctl --user --boot` (lightm redirects the sxmo session stdout => systemd)
|
|
|
|
#
|
|
|
|
# - default components:
|
|
|
|
# - DE: sway (if wayland), dwm (if X)
|
|
|
|
# - menus: bemenu (if wayland), dmenu (if X)
|
|
|
|
# - gestures: lisgd
|
|
|
|
# - on-screen keyboard: wvkbd (if wayland), svkbd (if X)
|
|
|
|
#
|
2023-05-16 11:09:57 +00:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
2023-05-17 06:58:37 +00:00
|
|
|
cfg = config.sane.gui.sxmo;
|
2023-05-16 11:09:57 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
sane.gui.sxmo.enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
};
|
2023-05-17 06:58:37 +00:00
|
|
|
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_<thing>.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_<thing>.sh
|
|
|
|
which is called by sxmo at key moments to proide user programmability.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
sane.gui.sxmo.terminal = mkOption {
|
2023-05-18 11:10:28 +00:00
|
|
|
# type = types.nullOr (types.enum [ "foot" "st" "vte" ]);
|
|
|
|
type = types.nullOr types.string;
|
|
|
|
default = "kitty";
|
2023-05-17 06:58:37 +00:00
|
|
|
description = ''
|
2023-05-18 11:10:28 +00:00
|
|
|
name of terminal to use for sxmo_terminal.sh.
|
|
|
|
foot, st, and vte have special integrations in sxmo, but any will work.
|
2023-05-17 06:58:37 +00:00
|
|
|
'';
|
|
|
|
};
|
2023-05-16 11:09:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
{
|
|
|
|
sane.programs.sxmoApps = {
|
|
|
|
package = null;
|
|
|
|
suggestedPrograms = [
|
|
|
|
"guiApps"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-05-17 06:58:37 +00:00
|
|
|
(mkIf cfg.enable {
|
2023-05-16 11:09:57 +00:00
|
|
|
sane.programs.sxmoApps.enableFor.user.colin = true;
|
|
|
|
|
|
|
|
# TODO: probably need to enable pipewire
|
|
|
|
|
|
|
|
networking.useDHCP = false;
|
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
networking.wireless.enable = lib.mkForce false;
|
|
|
|
|
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
services.blueman.enable = true;
|
|
|
|
|
2023-05-16 11:10:19 +00:00
|
|
|
# sxmo internally uses doas instead of sudo
|
|
|
|
security.doas.enable = true;
|
|
|
|
security.doas.wheelNeedsPassword = false;
|
|
|
|
|
|
|
|
# services.xserver.windowManager.session = [{
|
|
|
|
# name = "sxmo";
|
|
|
|
# desktopNames = [ "sxmo" ];
|
|
|
|
# start = ''
|
|
|
|
# ${pkgs.sxmo-utils}/bin/sxmo_xinit.sh &
|
|
|
|
# waitPID=$!
|
|
|
|
# '';
|
|
|
|
# }];
|
|
|
|
# services.xserver.enable = true;
|
|
|
|
|
|
|
|
# services.greetd = {
|
|
|
|
# enable = true;
|
|
|
|
# settings = {
|
|
|
|
# default_session = {
|
|
|
|
# command = "${pkgs.sxmo-utils}/bin/sxmo_winit.sh";
|
|
|
|
# user = "colin";
|
|
|
|
# };
|
|
|
|
# };
|
|
|
|
# };
|
|
|
|
|
|
|
|
services.xserver.enable = true;
|
|
|
|
services.xserver.displayManager.lightdm.enable = true;
|
|
|
|
services.xserver.displayManager.lightdm.greeters.gtk.enable = true;
|
|
|
|
services.xserver.displayManager.lightdm.extraSeatDefaults = ''
|
|
|
|
user-session = swmo
|
|
|
|
'';
|
|
|
|
services.xserver.displayManager.sessionPackages = [ pkgs.sxmo-utils ];
|
|
|
|
|
2023-05-17 10:18:58 +00:00
|
|
|
# TODO: not all of these fonts seem to be mapped to the correct icon
|
2023-05-17 07:16:30 +00:00
|
|
|
fonts.fonts = [ pkgs.nerdfonts ];
|
|
|
|
|
2023-05-17 10:19:13 +00:00
|
|
|
# i believe sxmo recomments a different audio stack
|
|
|
|
# administer with pw-cli, pw-mon, pw-top commands
|
|
|
|
services.pipewire = {
|
|
|
|
enable = true;
|
|
|
|
alsa.enable = true;
|
|
|
|
alsa.support32Bit = true; # ??
|
|
|
|
pulse.enable = true;
|
|
|
|
};
|
|
|
|
systemd.user.services."pipewire".wantedBy = [ "graphical-session.target" ];
|
|
|
|
|
2023-05-16 11:10:19 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
2023-05-18 09:03:03 +00:00
|
|
|
bc
|
2023-05-17 00:25:14 +00:00
|
|
|
bemenu
|
2023-05-18 09:03:03 +00:00
|
|
|
bonsai
|
2023-05-17 10:18:58 +00:00
|
|
|
conky
|
2023-05-16 11:10:19 +00:00
|
|
|
gojq
|
|
|
|
inotify-tools
|
2023-05-19 00:04:18 +00:00
|
|
|
jq
|
2023-05-16 11:10:19 +00:00
|
|
|
libnotify
|
2023-05-17 00:25:14 +00:00
|
|
|
lisgd
|
2023-05-17 06:58:37 +00:00
|
|
|
mako
|
2023-05-16 11:10:19 +00:00
|
|
|
superd
|
|
|
|
sway
|
2023-05-19 00:09:23 +00:00
|
|
|
swayidle
|
2023-05-16 11:10:19 +00:00
|
|
|
sxmo-utils
|
2023-05-17 10:18:58 +00:00
|
|
|
wob
|
|
|
|
xdg-user-dirs
|
|
|
|
|
2023-05-17 06:58:37 +00:00
|
|
|
cfg.deviceHooks
|
|
|
|
cfg.hooks
|
|
|
|
] ++ 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";
|
2023-05-18 11:10:43 +00:00
|
|
|
# these identifiers are from `swaymsg -t get_inputs`
|
|
|
|
SXMO_VOLUME_BUTTON = "1:1:AT_Translated_Set_2_keyboard";
|
|
|
|
SXMO_POWER_BUTTON = "0:1:Power_Button";
|
2023-05-19 00:09:02 +00:00
|
|
|
SXMO_DISABLE_LEDS = "1";
|
2023-05-17 06:58:37 +00:00
|
|
|
# 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 <repo:mil/sxmo-utils:scripts/deviceprofiles>
|
|
|
|
# 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);
|
|
|
|
};
|
2023-05-16 11:09:57 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|