diff --git a/hosts/modules/gui/sxmo.nix b/hosts/modules/gui/sxmo.nix new file mode 100644 index 000000000..c1acbe475 --- /dev/null +++ b/hosts/modules/gui/sxmo.nix @@ -0,0 +1,49 @@ +# this work derives from noneucat's sxmo service/packages, found via NUR +# - +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.sane.gui.phosh; +in +{ + options = { + sane.gui.sxmo.enable = mkOption { + default = false; + type = types.bool; + }; + }; + + config = mkMerge [ + { + sane.programs.sxmoApps = { + package = null; + suggestedPrograms = [ + "guiApps" + ]; + }; + } + + (mkIf config.sane.gui.sxmo.enable { + 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; + + services.xserver.windowManager.session = [{ + name = "sxmo"; + desktopNames = [ "sxmo" ]; + start = '' + ${pkgs.sxmo-utils}/bin/sxmo_xinit.sh & + waitPID=$! + ''; + }]; + }) + ]; +} diff --git a/pkgs/additional/sxmo-utils/0001-group-differs-from-user.patch b/pkgs/additional/sxmo-utils/0001-group-differs-from-user.patch new file mode 100644 index 000000000..89d004541 --- /dev/null +++ b/pkgs/additional/sxmo-utils/0001-group-differs-from-user.patch @@ -0,0 +1,23 @@ +diff --git a/configs/profile.d/sxmo_init.sh b/configs/profile.d/sxmo_init.sh +index 55baab3..2d33ea1 100644 +--- a/configs/profile.d/sxmo_init.sh ++++ b/configs/profile.d/sxmo_init.sh +@@ -158,13 +158,15 @@ _sxmo_grab_session() { + } + + _sxmo_prepare_dirs() { ++ uid=$(id -u) ++ gid=$(id -g) + mkdir -p "$XDG_RUNTIME_DIR" + chmod 700 "$XDG_RUNTIME_DIR" +- chown "$USER:$USER" "$XDG_RUNTIME_DIR" ++ chown "$uid:$gid" "$XDG_RUNTIME_DIR" + + mkdir -p "$XDG_CACHE_HOME/sxmo/" + chmod 700 "$XDG_CACHE_HOME" +- chown "$USER:$USER" "$XDG_CACHE_HOME" ++ chown "$uid:$gid" "$XDG_CACHE_HOME" + } + + _sxmo_grab_session + diff --git a/pkgs/additional/sxmo-utils/0002-ensure-log-dir.patch b/pkgs/additional/sxmo-utils/0002-ensure-log-dir.patch new file mode 100644 index 000000000..fd18d137e --- /dev/null +++ b/pkgs/additional/sxmo-utils/0002-ensure-log-dir.patch @@ -0,0 +1,15 @@ +diff --git a/configs/profile.d/sxmo_init.sh b/configs/profile.d/sxmo_init.sh +index 2d33ea1..76c4c94 100644 +--- a/configs/profile.d/sxmo_init.sh ++++ b/configs/profile.d/sxmo_init.sh +@@ -167,6 +167,10 @@ _sxmo_prepare_dirs() { + mkdir -p "$XDG_CACHE_HOME/sxmo/" + chmod 700 "$XDG_CACHE_HOME" + chown "$uid:$gid" "$XDG_CACHE_HOME" ++ ++ mkdir -p "$XDG_STATE_HOME" ++ chmod 700 "$XDG_STATE_HOME" ++ chown "$uid:$gid" "$XDG_STATE_HOME" + } + + _sxmo_grab_session diff --git a/pkgs/additional/sxmo-utils/default.nix b/pkgs/additional/sxmo-utils/default.nix index e08c73f6b..c7775a3cb 100644 --- a/pkgs/additional/sxmo-utils/default.nix +++ b/pkgs/additional/sxmo-utils/default.nix @@ -6,16 +6,22 @@ stdenv.mkDerivation rec { pname = "sxmo-utils"; - version = "1.13.0"; + version = "1.14.1"; src = fetchgit { url = "https://git.sr.ht/~mil/sxmo-utils"; rev = version; - hash = "sha256-HNkajPC/spozxRlaP0iMWvOAfriRjl2wo1wdcbVCrkU="; + hash = "sha256-UcJid1fi3Mgu32dCqlI9RQYnu5d07MMwW3eEYuYVBw4="; }; + patches = [ + ./0001-group-differs-from-user.patch + ./0002-ensure-log-dir.patch + ]; + postPatch = '' sed -i 's@/usr/lib/udev/rules\.d@/etc/udev/rules.d@' Makefile + sed -i "s@/etc/profile\.d/sxmo_init.sh@$out/etc/profile.d/sxmo_init.sh@" scripts/core/*.sh ''; installFlags = [ @@ -24,7 +30,10 @@ stdenv.mkDerivation rec { "PREFIX=" ]; - passthru.updateScript = gitUpdater { }; + passthru = { + providedSessions = [ "sxmo" "swmo" ]; + updateScript = gitUpdater { }; + }; meta = { homepage = "https://git.sr.ht/~mil/sxmo-utils";