From 259a40e9155ef168c65b58454d228ac9aaa871bc Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Wed, 18 Oct 2023 13:29:14 +0200 Subject: [PATCH] element-desktop and signal-desktop on Wayland --- hosts/yodaNas/configuration.nix | 2 ++ hosts/yodaTab/configuration.nix | 2 ++ hosts/yodaTux/configuration.nix | 2 ++ hosts/yodaYoga/configuration.nix | 2 ++ modules/element-desktop.nix | 19 ++++++++++ modules/programs.nix | 10 ------ modules/signal-desktop.nix | 59 ++++++++++++++++++++++++++++++++ 7 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 modules/element-desktop.nix create mode 100644 modules/signal-desktop.nix diff --git a/hosts/yodaNas/configuration.nix b/hosts/yodaNas/configuration.nix index ff6dbea..e4284a4 100644 --- a/hosts/yodaNas/configuration.nix +++ b/hosts/yodaNas/configuration.nix @@ -20,6 +20,8 @@ #../../modules/programs.nix #../../modules/boxes.nix + #../../modules/signal-desktop.nix + #../../modules/element-desktop.nix #../../modules/autostart.nix #../../modules/wallpaper.nix #../../modules/fwupd-gnome.nix diff --git a/hosts/yodaTab/configuration.nix b/hosts/yodaTab/configuration.nix index d129784..3a925a7 100644 --- a/hosts/yodaTab/configuration.nix +++ b/hosts/yodaTab/configuration.nix @@ -19,6 +19,8 @@ ../../modules/programs.nix #../../modules/boxes.nix + ../../modules/signal-desktop.nix + ../../modules/element-desktop.nix ../../modules/autostart.nix ../../modules/wallpaper.nix ../../modules/fwupd-gnome.nix diff --git a/hosts/yodaTux/configuration.nix b/hosts/yodaTux/configuration.nix index fe5934a..5557d99 100644 --- a/hosts/yodaTux/configuration.nix +++ b/hosts/yodaTux/configuration.nix @@ -19,6 +19,8 @@ ../../modules/programs.nix ../../modules/boxes.nix + ../../modules/signal-desktop.nix + ../../modules/element-desktop.nix ../../modules/autostart.nix ../../modules/wallpaper.nix ../../modules/fwupd-gnome.nix diff --git a/hosts/yodaYoga/configuration.nix b/hosts/yodaYoga/configuration.nix index 2bb6ad3..ae220a6 100644 --- a/hosts/yodaYoga/configuration.nix +++ b/hosts/yodaYoga/configuration.nix @@ -20,6 +20,8 @@ #../../modules/programs.nix #../../modules/boxes.nix + #../../modules/signal-desktop.nix + #../../modules/element-desktop.nix #../../modules/autostart.nix #../../modules/wallpaper.nix #../../modules/fwupd-gnome.nix diff --git a/modules/element-desktop.nix b/modules/element-desktop.nix new file mode 100644 index 0000000..5d4689b --- /dev/null +++ b/modules/element-desktop.nix @@ -0,0 +1,19 @@ +{ config, pkgs, lib, ... }: +{ + users.users.yoda = { + packages = with pkgs; [ + # Matrix clients + element-desktop + #fluffychat + # Web version: https://app.cinny.in/ + #cinny-desktop + # E2E encryption is not yet implemented: https://gitlab.gnome.org/GNOME/fractal/-/issues/717 + #fractal + #nheko + ]; + }; + + # The Element package already includes a wrapper that automatically adds `--enable-features=UseOzonePlatform` and `--ozone-platform=wayland` when `NIXOS_OZONE_WL` is set. + # https://discourse.nixos.org/t/partly-overriding-a-desktop-entry/20743/2 + environment.sessionVariables.NIXOS_OZONE_WL = lib.mkIf (config.services.xserver.displayManager.gdm.wayland) "1"; +} diff --git a/modules/programs.nix b/modules/programs.nix index 6613954..31bbf48 100644 --- a/modules/programs.nix +++ b/modules/programs.nix @@ -45,17 +45,7 @@ # For spellcheck, see here: https://nixos.wiki/wiki/LibreOffice#Spellcheck libreoffice-fresh anki-bin # Flashcards - signal-desktop # Signal client transmission-gtk # BitTorrent client - - # Matrix clients - element-desktop - #fluffychat - # Web version: https://app.cinny.in/ - #cinny-desktop - # E2E encryption is not yet implemented: https://gitlab.gnome.org/GNOME/fractal/-/issues/717 - #fractal - #nheko ]; }; diff --git a/modules/signal-desktop.nix b/modules/signal-desktop.nix new file mode 100644 index 0000000..cfdf5c0 --- /dev/null +++ b/modules/signal-desktop.nix @@ -0,0 +1,59 @@ +{ config, pkgs, lib, ... }: +{ + # Import unstable with niv. + nixpkgs.config.packageOverrides = pkgs: { + unstable = import (import ../nix/sources.nix).unstable { + inherit pkgs; + }; + }; + + users.users.yoda = { + packages = with pkgs; [ + signal-desktop-beta # Signal client + ]; + }; +# users.users.yoda = { +# packages = with pkgs.unstable; [ +# signal-desktop-beta # Signal client +# ]; +# }; + + # TODO: Signal on Wayland without crash + # Signal does also use the NIXOS_OZONE_WL variable to enable Wayland support. + # However, it does currently crash in this mode. + # See + # https://github.com/stelcodes/nixos-config/commit/79071d30912c5b6c2560654925bcc98533cf758f + # https://github.com/NixOS/nixpkgs/pull/222163 + # https://github.com/NixOS/nixpkgs/issues/261101 + + # Wayland support: + # The following worked once ... But currently Signal crashes. + # signal-desktop-beta --use-tray-icon --enable-features=UseOzonePlatform --ozone-platform=wayland + + # Temporary fix. + # https://github.com/NixOS/nixpkgs/issues/222043#issuecomment-1493457041 +# nixpkgs.overlays = [ +# (self: super: { +# signal-desktop-beta = super.signal-desktop-beta.overrideAttrs (old: { +# preFixup = old.preFixup + '' +# gappsWrapperArgs+=( +# --add-flags "--enable-features=UseOzonePlatform" +# --add-flags "--ozone-platform=wayland" +# ) +# ''; +# }); +# }) +# ]; +# nixpkgs.overlays = [ +# (self: super: { +# unstable.signal-desktop-beta = super.unstable.signal-desktop-beta.overrideAttrs (old: { +# preFixup = old.preFixup + '' +# gappsWrapperArgs+=( +# --add-flags "--enable-features=UseOzonePlatform" +# --add-flags "--ozone-platform=wayland" +# ) +# ''; +# }); +# }) +# ]; +}