From c6f08ef074c6eacea05dc53c2bb1229156d2434a Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sun, 24 Aug 2025 15:19:17 +0200 Subject: [PATCH 1/5] feat(home-manager): install nixgl --- flake.nix | 3 ++- home-manager/default.nix | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 251eabc..21b1c7b 100644 --- a/flake.nix +++ b/flake.nix @@ -51,11 +51,12 @@ overlays = [ nixgl.overlay ]; }; extraSpecialArgs = { - inherit stateVersion inputs; + inherit stateVersion inputs nixgl; hostname = hostname; username = username; }; modules = [ + { nixpkgs.overlays = [ nixgl.overlay ];} ./home-manager/default.nix ]; }; diff --git a/home-manager/default.nix b/home-manager/default.nix index befa969..f70cd47 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,4 +1,4 @@ -{ inputs, lib, stateVersion, username, hostname, ... }: +{ inputs, lib, stateVersion, username, hostname, nixgl, ... }: { imports = [ inputs.sops-nix.homeManagerModules.sops @@ -12,7 +12,9 @@ nixpkgs.config.allowUnfree = true; programs.home-manager.enable = true; fonts.fontconfig.enable = true; - + nixGL.packages = nixgl.packages; + nixGL.defaultWrapper = "mesa"; + nixGL.installScripts = ["mesa"]; home = { inherit stateVersion username; homeDirectory = "/home/${username}"; From a26f773f011b9cef6cf3d619d76c881fbad90cf1 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sun, 24 Aug 2025 15:28:12 +0200 Subject: [PATCH 2/5] chore(sway): acctivate nixgl --- modules/home-manager/desktop/sway/includes/sway.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/home-manager/desktop/sway/includes/sway.nix b/modules/home-manager/desktop/sway/includes/sway.nix index 004322b..d556c05 100644 --- a/modules/home-manager/desktop/sway/includes/sway.nix +++ b/modules/home-manager/desktop/sway/includes/sway.nix @@ -6,6 +6,7 @@ in { config = mkIf config.modules.desktop.sway.enable { wayland.windowManager.sway = { + package = config.lib.nixGL.wrap pkgs.sway; enable = true; wrapperFeatures.gtk = true; systemd.enable = true; From cb47a9aedaf814a28f688616ed50bd824594a4ee Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sun, 24 Aug 2025 15:37:21 +0200 Subject: [PATCH 3/5] chore(sway): xdg portal is now configured with home-manager --- modules/home-manager/desktop/sway/default.nix | 14 ++++++++++++++ modules/nixos/desktop/sway/default.nix | 15 --------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/modules/home-manager/desktop/sway/default.nix b/modules/home-manager/desktop/sway/default.nix index 57a6c16..7de3dd6 100644 --- a/modules/home-manager/desktop/sway/default.nix +++ b/modules/home-manager/desktop/sway/default.nix @@ -158,6 +158,20 @@ in desktop = "${config.home.homeDirectory}/documents"; publicShare = "${config.home.homeDirectory}/tmp/public"; }; + portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + xdgOpenUsePortal = true; + config = { + sway.default = [ + "wlr" + "gtk" + ]; + }; + }; }; }; } diff --git a/modules/nixos/desktop/sway/default.nix b/modules/nixos/desktop/sway/default.nix index 5d65618..c7427a8 100644 --- a/modules/nixos/desktop/sway/default.nix +++ b/modules/nixos/desktop/sway/default.nix @@ -16,20 +16,5 @@ in alsa.support32Bit = true; pulse.enable = true; }; - xdg.portal = { - enable = true; - wlr.enable = true; - # gtk portal needed to make gtk apps happy - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - config = { - common = { - default = [ - "gtk" - ]; - "org.freedesktop.impl.portal.ScreenCast" = "wlr"; - "org.freedesktop.impl.portal.Screenshot" = "wlr"; - }; - }; - }; }; } From 28ea3fd3e8ae36d093f479d8f60a9a49a84fa6ee Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sun, 24 Aug 2025 16:24:56 +0200 Subject: [PATCH 4/5] chore(firefox): use regular nixgl wrapper And remove `enableNixGL` configuration in related home configurations --- hosts/rick/home-config.nix | 1 - hosts/work/home-config.nix | 1 - modules/home-manager/web/firefox/default.nix | 27 ++------------------ 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/hosts/rick/home-config.nix b/hosts/rick/home-config.nix index 5a6295c..1be34e0 100644 --- a/hosts/rick/home-config.nix +++ b/hosts/rick/home-config.nix @@ -26,7 +26,6 @@ }; web.firefox = { enable = true; - enableNixGL = true; }; web.qutebrowser = { enable = true; diff --git a/hosts/work/home-config.nix b/hosts/work/home-config.nix index 0712e15..d089233 100644 --- a/hosts/work/home-config.nix +++ b/hosts/work/home-config.nix @@ -35,7 +35,6 @@ }; web.firefox = { enable = true; - enableNixGL = true; optionalExtensions = with pkgs.nur.repos.rycee.firefox-addons; [ okta-browser-plugin ]; diff --git a/modules/home-manager/web/firefox/default.nix b/modules/home-manager/web/firefox/default.nix index 191bdae..d52f8a9 100644 --- a/modules/home-manager/web/firefox/default.nix +++ b/modules/home-manager/web/firefox/default.nix @@ -29,11 +29,6 @@ in description = "Optional Firefox Plugins to install"; }; - enableNixGL = mkOption { - type = types.bool; - default = false; - description = "Use NixGL to start Firefox"; - }; }; config = mkIf cfg.enable { programs.browserpass = { @@ -47,24 +42,6 @@ in "x-scheme-handler/about" = "firefox.desktop"; "x-scheme-handler/unknown" = "firefox.desktop"; }; - xdg.desktopEntries."firefox" = mkIf cfg.enableNixGL { - name = "Firefox NixGL Powered"; - exec = "${pkgs.nixgl.nixGLMesa}/bin/nixGLMesa firefox %U"; - icon = "firefox"; - terminal = false; - type = "Application"; - startupNotify = true; - actions = { - "new-private-window" = { - exec = "${pkgs.nixgl.nixGLMesa}/bin/nixGLMesa firefox --private-window %U"; - name = "New Private Window"; - }; - "new-window" = { - exec = "${pkgs.nixgl.nixGLMesa}/bin/nixGLMesa firefox --new-window %U"; - name = "New Window"; - }; - }; - }; xdg.configFile."tridactyl/tridactylrc".text = '' sanitize tridactyllocal tridactylsync @@ -93,13 +70,13 @@ in allExtensions = cfg.baseExtensions ++ cfg.optionalExtensions; in { enable = true; - package = pkgs.wrapFirefox pkgs.firefox-unwrapped { + package = config.lib.nixGL.wrap ( pkgs.wrapFirefox pkgs.firefox-unwrapped { nativeMessagingHosts = [ # Tridactyl native connector pkgs.tridactyl-native pkgs.browserpass ]; - }; + }); profiles.ephase = { id = 0; name = "ephase"; From 85520706655be6ab0be73245646d8299afb9cd91 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sun, 24 Aug 2025 16:36:58 +0200 Subject: [PATCH 5/5] chore(qutebrowser): use regular nixgl wrapper --- hosts/rick/home-config.nix | 9 ++----- .../home-manager/web/qutebrowser/default.nix | 24 +------------------ 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/hosts/rick/home-config.nix b/hosts/rick/home-config.nix index 1be34e0..a72cdf0 100644 --- a/hosts/rick/home-config.nix +++ b/hosts/rick/home-config.nix @@ -24,13 +24,8 @@ kdenlive.enable = false; mpv.enable = false; }; - web.firefox = { - enable = true; - }; - web.qutebrowser = { - enable = true; - enableNixGL = true; - }; + web.firefox.enable = true; + web.qutebrowser.enable = true; web.webcord.enable = false; gaming.lutris.enable = false; desktop.sway = { diff --git a/modules/home-manager/web/qutebrowser/default.nix b/modules/home-manager/web/qutebrowser/default.nix index 81549e1..b626027 100644 --- a/modules/home-manager/web/qutebrowser/default.nix +++ b/modules/home-manager/web/qutebrowser/default.nix @@ -6,35 +6,13 @@ in { options.modules.web.qutebrowser = { enable = mkEnableOption "enable Qutebrowser web browser"; - - enableNixGL = mkOption { - type = types.bool; - default = false; - description = "Use NixGL to start Qutebrowser"; - }; - }; config = mkIf cfg.enable { - xdg.desktopEntries."org.qutebrowser.qutebrowser" = mkIf cfg.enableNixGL { - name = "QuteBrowser NixGL Powered"; - - exec = "${pkgs.nixgl.nixGLMesa}/bin/nixGLMesa qutebrowser %u"; - icon = "qutebrowser"; - terminal = false; - type = "Application"; - startupNotify = true; - actions = { - "preference" = { - exec = "${pkgs.nixgl.nixGLMesa}/bin/nixGLMesa qutebrowser \"qute://settings\""; - name = "Preferences"; - }; - }; - }; programs.qutebrowser = { enable = true; + package = config.lib.nixGL.wrap pkgs.qutebrowser; loadAutoconfig = true; settings = { - qt.args = [ "autoplay-policy=user-gesture-required" "ignore-gpu-blocklist"