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
|
|
|
#
|
2023-07-21 22:46:14 +00:00
|
|
|
# sxmo upstream links:
|
|
|
|
# - docs (rendered): <https://man.sr.ht/~anjan/sxmo-docs-next/>
|
|
|
|
# - issue tracker: <https://todo.sr.ht/~mil/sxmo-tickets>
|
|
|
|
# - mail list (patches): <https://lists.sr.ht/~mil/sxmo-devel>
|
2023-05-17 00:25:14 +00:00
|
|
|
#
|
|
|
|
# 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-08-26 09:40:07 +00:00
|
|
|
# - `journalctl --user --boot` (lightdm redirects the sxmo session stdout => systemd)
|
2023-05-17 00:25:14 +00:00
|
|
|
#
|
|
|
|
# - 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-09-03 08:48:43 +00:00
|
|
|
# TODO:
|
|
|
|
# - don't duplicate so much of hosts/modules/gui/sway
|
|
|
|
# - might help if i bring more under my control, and launch sxmo via sway instead of the opposite
|
|
|
|
# - theme `mako` notifications
|
2023-07-13 22:20:26 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2023-05-16 11:09:57 +00:00
|
|
|
|
|
|
|
let
|
2023-05-17 06:58:37 +00:00
|
|
|
cfg = config.sane.gui.sxmo;
|
2023-07-03 22:27:29 +00:00
|
|
|
knownKeyboards = {
|
|
|
|
# map keyboard package name -> name of binary to invoke
|
|
|
|
wvkbd = "wvkbd-mobintl";
|
|
|
|
svkbd = "svkbd-mobile-intl";
|
|
|
|
};
|
|
|
|
knownTerminals = {
|
|
|
|
vte = "vte-2.91";
|
|
|
|
};
|
2023-08-26 12:28:25 +00:00
|
|
|
|
|
|
|
systemd-cat = "${pkgs.systemd}/bin/systemd-cat";
|
|
|
|
runWithLogger = identifier: cmd: pkgs.writeShellScript identifier ''
|
|
|
|
echo "launching ${identifier}..." | ${systemd-cat} --identifier=${identifier}
|
|
|
|
${cmd} 2>&1 | ${systemd-cat} --identifier=${identifier}
|
|
|
|
'';
|
2023-05-16 11:09:57 +00:00
|
|
|
in
|
|
|
|
{
|
2023-05-19 10:18:26 +00:00
|
|
|
options = with lib; {
|
2023-05-16 11:09:57 +00:00
|
|
|
sane.gui.sxmo.enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
};
|
2023-05-19 10:18:26 +00:00
|
|
|
sane.gui.sxmo.greeter = mkOption {
|
2023-08-26 12:28:25 +00:00
|
|
|
type = types.enum [
|
|
|
|
"greetd-phog"
|
2023-09-04 01:06:16 +00:00
|
|
|
"greetd-sway-gtkgreet"
|
2023-08-26 12:28:25 +00:00
|
|
|
"greetd-sway-phog"
|
|
|
|
"greetd-sxmo"
|
|
|
|
"lightdm-mobile"
|
|
|
|
];
|
2023-08-26 19:55:36 +00:00
|
|
|
# default = "lightdm-mobile";
|
|
|
|
default = "greetd-sway-phog";
|
2023-05-19 10:18:26 +00:00
|
|
|
description = ''
|
|
|
|
which greeter to use.
|
2023-09-04 01:06:16 +00:00
|
|
|
"greetd-phog" => phosh-based greeter. keypad (0-9) with option to open an on-screen keyboard.
|
|
|
|
"greetd-sway-phog" => phog, but uses sway as the compositor instead of phoc.
|
2023-08-26 19:54:58 +00:00
|
|
|
requires a patched phog, since sway doesn't provide the Wayland global "zphoc_layer_shell_effects_v1".
|
2023-09-04 01:06:16 +00:00
|
|
|
"greetd-sxmo" => launch sxmo directly from greetd, no auth.
|
|
|
|
this means no keychain unlocked or encrypted home mounted.
|
|
|
|
"lightdm-mobile" => keypad style greeter. can only enter digits 0-9 as password.
|
|
|
|
"greetd-sway-gtkgreet" => layered sway greeter. keyboard-only user/pass input; impractical on mobile.
|
2023-05-19 10:18:26 +00:00
|
|
|
'';
|
|
|
|
};
|
2023-06-23 08:38:23 +00:00
|
|
|
sane.gui.sxmo.package = mkOption {
|
|
|
|
type = types.package;
|
2023-08-28 09:56:02 +00:00
|
|
|
default = pkgs.sxmo-utils-latest;
|
2023-05-17 06:58:37 +00:00
|
|
|
description = ''
|
2023-06-23 09:13:57 +00:00
|
|
|
sxmo base scripts and hooks collection.
|
|
|
|
consider overriding the outputs under /share/sxmo/default_hooks
|
|
|
|
to insert your own user scripts.
|
2023-05-17 06:58:37 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
sane.gui.sxmo.terminal = mkOption {
|
2023-05-18 11:10:28 +00:00
|
|
|
# type = types.nullOr (types.enum [ "foot" "st" "vte" ]);
|
2023-05-31 04:27:27 +00:00
|
|
|
type = types.nullOr types.str;
|
2023-05-19 08:04:17 +00:00
|
|
|
default = "foot";
|
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-24 06:06:16 +00:00
|
|
|
sane.gui.sxmo.keyboard = mkOption {
|
|
|
|
# type = types.nullOr (types.enum ["wvkbd"])
|
2023-05-31 04:27:27 +00:00
|
|
|
type = types.nullOr types.str;
|
2023-05-24 06:06:16 +00:00
|
|
|
default = "wvkbd";
|
|
|
|
description = ''
|
|
|
|
name of on-screen-keyboard to use for sxmo_keyboard.sh.
|
|
|
|
this sets the KEYBOARD environment variable.
|
|
|
|
see also: KEYBOARD_ARGS.
|
|
|
|
'';
|
|
|
|
};
|
2023-05-19 09:36:17 +00:00
|
|
|
sane.gui.sxmo.settings = mkOption {
|
|
|
|
description = ''
|
|
|
|
environment variables used to configure sxmo.
|
|
|
|
e.g. SXMO_UNLOCK_IDLE_TIME or SXMO_VOLUME_BUTTON.
|
|
|
|
'';
|
2023-06-20 00:13:39 +00:00
|
|
|
type = types.submodule {
|
|
|
|
freeformType = types.attrsOf types.str;
|
|
|
|
options =
|
|
|
|
let
|
|
|
|
mkSettingsOpt = default: description: mkOption {
|
|
|
|
inherit default description;
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
SXMO_BAR_SHOW_BAT_PER = mkSettingsOpt "1" "show battery percentage in statusbar";
|
2023-08-28 21:53:43 +00:00
|
|
|
SXMO_DISABLE_CONFIGVERSION_CHECK = mkSettingsOpt "1" "allow omitting the configversion line from user-provided sxmo dotfiles";
|
2023-06-20 00:13:39 +00:00
|
|
|
SXMO_UNLOCK_IDLE_TIME = mkSettingsOpt "300" "how many seconds of inactivity before locking the screen"; # lock -> screenoff happens 8s later, not configurable
|
2023-09-04 11:10:30 +00:00
|
|
|
# SXMO_WM = mkSettingsOpt "sway" "sway or dwm. ordinarily initialized by sxmo_{x,w}init.sh";
|
2023-06-20 00:13:39 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
default = {};
|
2023-05-19 09:36:17 +00:00
|
|
|
};
|
2023-06-20 00:05:06 +00:00
|
|
|
sane.gui.sxmo.noidle = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "inhibit lock-on-idle and screenoff-on-idle";
|
|
|
|
};
|
2023-07-25 10:56:29 +00:00
|
|
|
sane.gui.sxmo.nogesture = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "don't start lisgd gesture daemon by default";
|
|
|
|
};
|
2023-05-16 11:09:57 +00:00
|
|
|
};
|
|
|
|
|
2023-05-19 10:18:26 +00:00
|
|
|
config = lib.mkMerge [
|
2023-05-16 11:09:57 +00:00
|
|
|
{
|
|
|
|
sane.programs.sxmoApps = {
|
|
|
|
package = null;
|
|
|
|
suggestedPrograms = [
|
|
|
|
"guiApps"
|
2023-09-03 08:48:43 +00:00
|
|
|
"mako" # notification daemon
|
|
|
|
"sfeed" # want this here so that the user's ~/.sfeed/sfeedrc gets created
|
|
|
|
"superd" # make superctl (used by sxmo) be on PATH
|
|
|
|
"sway-contrib.grimshot"
|
|
|
|
"wdisplays" # like xrandr
|
2023-05-16 11:09:57 +00:00
|
|
|
];
|
2023-07-13 06:58:48 +00:00
|
|
|
|
|
|
|
persist.cryptClearOnBoot = [
|
|
|
|
# builds to be 10's of MB per day
|
|
|
|
".local/state/superd/logs"
|
|
|
|
];
|
2023-05-16 11:09:57 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-06-20 00:13:39 +00:00
|
|
|
{
|
|
|
|
# TODO: lift to option declaration
|
|
|
|
sane.gui.sxmo.settings.TERMCMD = lib.mkIf (cfg.terminal != null)
|
2023-07-03 22:27:29 +00:00
|
|
|
(lib.mkDefault (knownTerminals."${cfg.terminal}" or cfg.terminal));
|
2023-06-20 00:13:39 +00:00
|
|
|
sane.gui.sxmo.settings.KEYBOARD = lib.mkIf (cfg.keyboard != null)
|
2023-07-03 22:27:29 +00:00
|
|
|
(lib.mkDefault (knownKeyboards."${cfg.keyboard}" or cfg.keyboard));
|
2023-06-20 00:13:39 +00:00
|
|
|
}
|
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
(lib.mkIf cfg.enable (lib.mkMerge [
|
|
|
|
{
|
2023-09-04 11:10:30 +00:00
|
|
|
sane.gui.sway = {
|
|
|
|
enable = true;
|
|
|
|
# we manage these ourselves (TODO: merge these into sway config as well)
|
|
|
|
useGreeter = false;
|
|
|
|
installConfigs = false;
|
|
|
|
};
|
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
sane.programs.sxmoApps.enableFor.user.colin = true;
|
2023-05-16 11:09:57 +00:00
|
|
|
|
2023-07-13 08:20:30 +00:00
|
|
|
# sxmo internally uses doas instead of sudo
|
|
|
|
security.doas.enable = true;
|
|
|
|
security.doas.wheelNeedsPassword = false;
|
2023-05-23 10:54:55 +00:00
|
|
|
|
2023-08-26 19:54:58 +00:00
|
|
|
hardware.opengl.enable = true;
|
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
# TODO: nerdfonts is 4GB. it accepts an option to ship only some fonts: probably want to use that.
|
2023-07-30 02:26:17 +00:00
|
|
|
fonts.packages = [ pkgs.nerdfonts ];
|
2023-05-17 07:16:30 +00:00
|
|
|
|
2023-07-13 08:20:30 +00:00
|
|
|
# lightdm-mobile-greeter: "The name org.a11y.Bus was not provided by any .service files"
|
|
|
|
services.gnome.at-spi2-core.enable = true;
|
|
|
|
|
2023-09-03 08:48:43 +00:00
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
# TODO: could use `displayManager.sessionPackages`?
|
|
|
|
environment.systemPackages = [
|
|
|
|
cfg.package
|
2023-09-04 11:10:30 +00:00
|
|
|
pkgs.bonsai # sway (not sxmo) needs to exec `bonsaictl` by name (sxmo_swayinitconf.sh)
|
2023-07-13 07:17:09 +00:00
|
|
|
] ++ lib.optionals (cfg.terminal != null) [ pkgs."${cfg.terminal}" ]
|
|
|
|
++ lib.optionals (cfg.keyboard != null) [ pkgs."${cfg.keyboard}" ];
|
2023-05-19 08:03:51 +00:00
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
environment.sessionVariables = {
|
|
|
|
XDG_DATA_DIRS = [
|
|
|
|
# TODO: only need the share/sxmo directly linked
|
|
|
|
"${cfg.package}/share"
|
|
|
|
];
|
2023-08-29 06:33:20 +00:00
|
|
|
} // (lib.filterAttrs # certain settings are read before the `profile` is sourced
|
|
|
|
(k: v: k == "SXMO_DISABLE_CONFIGVERSION_CHECK")
|
|
|
|
cfg.settings
|
|
|
|
);
|
2023-05-19 10:18:26 +00:00
|
|
|
|
2023-09-04 11:10:30 +00:00
|
|
|
# sxmo puts in /share/sxmo:
|
|
|
|
# - profile.d/sxmo_init.sh
|
|
|
|
# - appcfg/
|
|
|
|
# - default_hooks/
|
|
|
|
# - and more
|
|
|
|
# environment.pathsToLink = [ "/share/sxmo" ];
|
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
systemd.services."sxmo-set-permissions" = {
|
|
|
|
description = "configure specific /sys and /dev nodes to be writable by sxmo scripts";
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
ExecStart = "${cfg.package}/bin/sxmo_setpermissions.sh";
|
|
|
|
};
|
2023-09-04 11:10:30 +00:00
|
|
|
wantedBy = [ "multi-user.service" ];
|
2023-07-13 07:17:09 +00:00
|
|
|
};
|
2023-07-12 10:03:58 +00:00
|
|
|
|
2023-07-24 01:36:13 +00:00
|
|
|
# if superd fails to start a service within 100ms, it'll try to start again
|
|
|
|
# the fallout of this is that during intense lag (e.g. OOM or swapping) it can
|
|
|
|
# start the service many times.
|
|
|
|
# see <repo:craftyguy/superd:internal/cmd/cmd.go>
|
|
|
|
# TODO: better fix may be to patch `sxmo_hook_lisgdstart.sh` and force it to behave as a singleton
|
|
|
|
systemd.services."dedupe-sxmo-lisgd" = {
|
|
|
|
description = "kill duplicate lisgd processes started by superd";
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
};
|
|
|
|
script = ''
|
|
|
|
if [ "$(${pkgs.procps}/bin/pgrep -c lisgd)" -gt 1 ]; then
|
|
|
|
echo 'killing duplicated lisgd daemons'
|
|
|
|
${pkgs.psmisc}/bin/killall lisgd # let superd restart it
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
|
|
|
systemd.timers."dedupe-sxmo-lisgd" = {
|
|
|
|
wantedBy = [ "dedupe-sxmo-lisgd.service" ];
|
|
|
|
timerConfig = {
|
|
|
|
OnUnitActiveSec = "2min";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-07-13 22:20:26 +00:00
|
|
|
sane.user.fs.".cache/sxmo/sxmo.noidle" = lib.mkIf cfg.noidle {
|
|
|
|
symlink.text = "";
|
|
|
|
};
|
2023-07-25 10:56:29 +00:00
|
|
|
sane.user.fs.".cache/sxmo/sxmo.nogesture" = lib.mkIf cfg.nogesture {
|
|
|
|
symlink.text = "";
|
|
|
|
};
|
2023-07-13 07:17:09 +00:00
|
|
|
sane.user.fs.".config/sxmo/profile".symlink.text = let
|
|
|
|
mkKeyValue = key: value: ''export ${key}="${value}"'';
|
2023-08-28 10:32:37 +00:00
|
|
|
in
|
|
|
|
lib.generators.toKeyValue { inherit mkKeyValue; } cfg.settings;
|
2023-07-12 10:03:58 +00:00
|
|
|
|
2023-09-04 11:10:30 +00:00
|
|
|
sane.user.fs.".config/sway/config".symlink.target = pkgs.substituteAll {
|
2023-07-13 07:17:09 +00:00
|
|
|
src = ./sway-config;
|
|
|
|
waybar = "${pkgs.waybar}/bin/waybar";
|
2023-09-04 11:10:30 +00:00
|
|
|
bemenu_run = "${pkgs.bemenu}/bin/bemenu-run";
|
|
|
|
term = "${pkgs.xdg-terminal-exec}/bin/xdg-terminal-exec";
|
|
|
|
sxmo_init = pkgs.writeShellScript "sxmo_init.sh" ''
|
|
|
|
# perform the same behavior as sxmo_{x,w}init.sh -- but without actually launching wayland/X11
|
|
|
|
# this amounts to:
|
|
|
|
# - setting env vars (e.g. getting the hooks onto PATH)
|
|
|
|
# - placing default configs in ~ for sxmo-launched services (sxmo_migrate.sh)
|
2023-09-04 11:33:14 +00:00
|
|
|
# - binding vol/power buttons (sxmo_swayinitconf.sh)
|
2023-09-04 11:10:30 +00:00
|
|
|
# - launching sxmo_hook_start.sh
|
|
|
|
source ${cfg.package}/etc/profile.d/sxmo_init.sh
|
|
|
|
# XXX: upstream sources `profile` later (after sxmo_migrate)
|
|
|
|
# but _sxmo_load_environments uses `SXMO_DEVICE_NAME`,
|
|
|
|
# and i ship that via the profile, so order it such
|
|
|
|
source "$XDG_CONFIG_HOME/sxmo/profile"
|
|
|
|
_sxmo_load_environments
|
|
|
|
_sxmo_prepare_dirs
|
|
|
|
sxmo_migrate.sh sync
|
|
|
|
|
|
|
|
# kill anything leftover from the previous sxmo run. this way we can (try to) be reentrant
|
|
|
|
echo "sxmo_init: killing stale daemons (if active)"
|
|
|
|
sxmo_daemons.sh stop all
|
|
|
|
pkill bemenu
|
|
|
|
pkill wvkbd
|
|
|
|
pkill superd
|
|
|
|
|
|
|
|
# configure vol/power-button input mapping (upstream SXMO has this in sway config)
|
|
|
|
sxmo_swayinitconf.sh
|
|
|
|
|
|
|
|
echo "sxmo_init: invoking sxmo_hook_start.sh with:"
|
|
|
|
echo "PATH: $PATH"
|
|
|
|
sxmo_hook_start.sh
|
|
|
|
'';
|
2023-07-13 00:40:52 +00:00
|
|
|
};
|
2023-05-19 10:18:26 +00:00
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
sane.user.fs.".config/waybar/config".symlink.target =
|
|
|
|
let
|
|
|
|
waybar-config = import ./waybar-config.nix { inherit pkgs; };
|
|
|
|
in
|
|
|
|
(pkgs.formats.json {}).generate "waybar-config.json" waybar-config;
|
2023-05-19 10:18:26 +00:00
|
|
|
|
2023-07-24 08:13:56 +00:00
|
|
|
sane.user.fs.".config/waybar/style.css".symlink.text =
|
|
|
|
builtins.readFile ./waybar-style.css;
|
2023-05-19 10:18:26 +00:00
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
sane.user.fs.".config/sxmo/conky.conf".symlink.target = let
|
|
|
|
battery_estimate = pkgs.static-nix-shell.mkBash {
|
|
|
|
pname = "battery_estimate";
|
|
|
|
src = ./.;
|
|
|
|
};
|
|
|
|
in pkgs.substituteAll {
|
|
|
|
src = ./conky-config;
|
|
|
|
bat = "${battery_estimate}/bin/battery_estimate";
|
2023-08-24 11:17:36 +00:00
|
|
|
weather = "timeout 20 ${pkgs.sane-weather}/bin/sane-weather";
|
2023-07-13 07:17:09 +00:00
|
|
|
};
|
|
|
|
}
|
2023-05-23 04:43:27 +00:00
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
(lib.mkIf (cfg.greeter == "lightdm-mobile") {
|
2023-07-13 06:56:03 +00:00
|
|
|
sane.persist.sys.plaintext = [
|
|
|
|
# this takes up 4-5 MB of fontconfig and mesa shader caches.
|
|
|
|
# it could optionally be cleared on boot.
|
|
|
|
{ path = "/var/lib/lightdm"; user = "lightdm"; group = "lightdm"; mode = "0770"; }
|
|
|
|
];
|
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
services.xserver = {
|
|
|
|
enable = true;
|
2023-05-19 10:18:26 +00:00
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
displayManager.lightdm.enable = true;
|
|
|
|
displayManager.lightdm.greeters.mobile.enable = true;
|
|
|
|
displayManager.lightdm.extraSeatDefaults = ''
|
|
|
|
user-session = swmo
|
2023-05-19 10:18:26 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
displayManager.sessionPackages = with pkgs; [
|
|
|
|
cfg.package # this gets share/wayland-sessions/swmo.desktop linked
|
|
|
|
];
|
|
|
|
|
|
|
|
# taken from gui/phosh:
|
|
|
|
# NB: setting defaultSession has the critical side-effect that it lets org.freedesktop.AccountsService
|
|
|
|
# know that our user exists. this ensures lightdm succeeds when calling /org/freedesktop/AccountsServices ListCachedUsers
|
|
|
|
# lightdm greeters get the login users from lightdm which gets it from org.freedesktop.Accounts.ListCachedUsers.
|
|
|
|
# this requires the user we want to login as to be cached.
|
|
|
|
displayManager.job.preStart = ''
|
|
|
|
${pkgs.systemd}/bin/busctl call org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts CacheUser s colin
|
|
|
|
'';
|
2023-06-23 08:30:18 +00:00
|
|
|
};
|
2023-07-13 07:17:09 +00:00
|
|
|
})
|
2023-06-23 08:30:18 +00:00
|
|
|
|
2023-09-04 01:06:16 +00:00
|
|
|
(lib.mkIf (cfg.greeter == "greetd-sway-gtkgreet") {
|
2023-09-02 00:49:44 +00:00
|
|
|
sane.gui.greetd = {
|
2023-07-13 07:17:09 +00:00
|
|
|
enable = true;
|
2023-09-02 00:49:44 +00:00
|
|
|
sway.enable = true;
|
|
|
|
sway.gtkgreet.enable = true;
|
2023-09-02 00:54:05 +00:00
|
|
|
sway.gtkgreet.session.name = "sxmo-on-gtkgreet";
|
2023-09-04 11:10:30 +00:00
|
|
|
# sway.gtkgreet.session.command = "${cfg.package}/bin/sxmo_winit.sh";
|
|
|
|
sway.gtkgreet.session.command = "${pkgs.sway}/bin/sway --debug";
|
2023-07-13 07:17:09 +00:00
|
|
|
};
|
|
|
|
})
|
2023-05-23 04:43:27 +00:00
|
|
|
|
2023-08-26 12:28:25 +00:00
|
|
|
(lib.mkIf (cfg.greeter == "greetd-sway-phog") {
|
2023-09-02 00:49:44 +00:00
|
|
|
sane.gui.greetd = {
|
2023-08-26 12:28:25 +00:00
|
|
|
enable = true;
|
2023-09-02 00:49:44 +00:00
|
|
|
sway.enable = true;
|
|
|
|
sway.greeterCmd = "${pkgs.phog}/libexec/phog";
|
2023-08-26 12:28:25 +00:00
|
|
|
};
|
|
|
|
# phog locates sxmo_winit.sh via <env>/share/wayland-sessions
|
|
|
|
environment.pathsToLink = [ "/share/wayland-sessions" ];
|
|
|
|
})
|
|
|
|
|
2023-08-26 09:40:07 +00:00
|
|
|
(lib.mkIf (cfg.greeter == "greetd-phog") {
|
2023-09-02 00:49:44 +00:00
|
|
|
sane.gui.greetd = {
|
2023-08-25 01:25:07 +00:00
|
|
|
enable = true;
|
2023-09-02 00:49:44 +00:00
|
|
|
session.name = "phog";
|
|
|
|
session.command = "${pkgs.phog}/bin/phog";
|
2023-08-25 01:25:07 +00:00
|
|
|
};
|
2023-09-02 00:49:44 +00:00
|
|
|
# phog locates sxmo_winit.sh via <env>/share/wayland-sessions
|
2023-08-25 13:29:29 +00:00
|
|
|
environment.pathsToLink = [ "/share/wayland-sessions" ];
|
2023-08-25 01:25:07 +00:00
|
|
|
})
|
|
|
|
|
2023-08-26 12:28:25 +00:00
|
|
|
(lib.mkIf (cfg.greeter == "greetd-sxmo") {
|
2023-09-02 00:49:44 +00:00
|
|
|
sane.gui.greetd = {
|
2023-08-26 12:28:25 +00:00
|
|
|
enable = true;
|
2023-09-02 00:49:44 +00:00
|
|
|
session.name = "sxmo";
|
2023-09-04 11:10:30 +00:00
|
|
|
# session.command = "${cfg.package}/bin/sxmo_winit.sh";
|
|
|
|
session.command = "${pkgs.sway}/bin/sway --debug";
|
2023-09-02 00:49:44 +00:00
|
|
|
session.user = "colin";
|
2023-08-26 12:28:25 +00:00
|
|
|
};
|
|
|
|
})
|
|
|
|
|
2023-07-13 07:17:09 +00:00
|
|
|
# old, greeterless options:
|
2023-05-19 10:18:26 +00:00
|
|
|
# services.xserver.windowManager.session = [{
|
|
|
|
# name = "sxmo";
|
|
|
|
# desktopNames = [ "sxmo" ];
|
|
|
|
# start = ''
|
2023-06-23 08:38:23 +00:00
|
|
|
# ${cfg.package}/bin/sxmo_xinit.sh &
|
2023-05-19 10:18:26 +00:00
|
|
|
# waitPID=$!
|
|
|
|
# '';
|
|
|
|
# }];
|
|
|
|
# services.xserver.enable = true;
|
2023-07-13 07:17:09 +00:00
|
|
|
]))
|
2023-05-16 11:09:57 +00:00
|
|
|
];
|
|
|
|
}
|