sway: port xwayland use to sane.programs API

This commit is contained in:
Colin 2024-02-21 23:32:10 +00:00
parent 50c3f04714
commit d1de9efde1
4 changed files with 18 additions and 28 deletions

View File

@ -7,6 +7,15 @@
{ pkgs, ... }:
{
sane.programs.element-desktop = {
packageUnwrapped = pkgs.element-desktop.override {
# use pre-build electron because otherwise it takes 4 hrs to build from source.
electron = pkgs.electron-bin;
};
suggestedPrograms = [
"gnome-keyring"
"xwayland"
];
sandbox.method = "bwrap";
sandbox.wrapperType = "wrappedDerivation";
sandbox.net = "clearnet";
@ -23,14 +32,7 @@
"tmp"
];
packageUnwrapped = pkgs.element-desktop.override {
# use pre-build electron because otherwise it takes 4 hrs to build from source.
electron = pkgs.electron-bin;
};
# creds/session keys, etc
persist.byStore.private = [ ".config/Element" ];
suggestedPrograms = [ "gnome-keyring" ];
};
}

View File

@ -29,9 +29,16 @@ let
};
swayPackage = wrapSway (pkgs.sway-unwrapped.overrideAttrs (_: {
# isNixOS = true; #< doesn't matter
#
# about xwayland:
# - required by many electron apps, though some electron apps support NIXOS_OZONE_WL=1 for native wayland.
# - when xwayland is enabled, KOreader incorrectly chooses the X11 backend
# -> slower; blurrier
# - xwayland uses a small amount of memory (like 30MiB, IIRC?)
#
# TODO: something else is dragging a xwayland-enabled wlroots into the environment,
# making this actually kinda wasteful.
enableXWayland = cfg.config.xwayland;
enableXWayland = config.sane.programs.xwayland.enabled;
}));
in
{
@ -81,14 +88,6 @@ in
- etc
'';
};
xwayland = mkOption {
type = types.bool;
default = true;
description = ''
whether or not to enable xwayland (allows running X11 apps on sway).
some electron apps (e.g. element-desktop) require xwayland.
'';
};
screenshot_cmd = mkOption {
type = types.str;
@ -199,11 +198,6 @@ in
# icon-theme = lib.mkDefault "Flat-Remix-Grey-Light"; # requires qtbase
};
# TODO: port to sane.programs
programs.xwayland = lib.mkIf cfg.enabled {
enable = cfg.config.xwayland;
};
services.gvfs = lib.mkIf cfg.enabled {
enable = true; # allow nautilus to mount remote filesystems (e.g. ftp://...)
package = lib.mkDefault (pkgs.gvfs.override {

View File

@ -35,5 +35,5 @@ in substituteAll {
mod
workspace_layout
;
xwayland = if swayCfg.xwayland then "enable" else "disable";
xwayland = if config.sane.programs.xwayland.enabled then "enable" else "disable";
}

View File

@ -310,12 +310,6 @@ in
# these could be added, but i don't see much benefit.
font = "pango:monospace 10";
mod = "Mod1"; # prefer Alt
# about xwayland:
# - required by many electron apps, though some electron apps support NIXOS_OZONE_WL=1 for native wayland.
# - when xwayland is enabled, KOreader incorrectly chooses the X11 backend
# -> slower; blurrier
# - xwayland uses a small amount of memory (like 30MiB, IIRC?)
xwayland = false;
workspace_layout = "tabbed";
screenshot_cmd = "sxmo_screenshot.sh";