From 21b9653225f9410e5da6d12921d1471accf3e386 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 23 Aug 2024 13:52:54 -0400 Subject: [PATCH] flatpak: integrate workarounds with stylix themes --- nixosModules/services/flatpak/default.nix | 34 ++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/nixosModules/services/flatpak/default.nix b/nixosModules/services/flatpak/default.nix index f46e517e..9bfaacb2 100644 --- a/nixosModules/services/flatpak/default.nix +++ b/nixosModules/services/flatpak/default.nix @@ -13,18 +13,44 @@ fsType = "fuse.bindfs"; options = ["ro" "resolve-symlinks" "x-gvfs-hide"]; }; + + aggregatedIcons = pkgs.buildEnv { + name = "system-icons"; + paths = + (with pkgs; [ + gnome.adwaita-icon-theme + gnome.gnome-themes-extra + ]) + ++ lib.optional (config.stylix.enable) config.stylix.cursor.package; + + pathsToLink = ["/share/icons"]; + }; + aggregatedFonts = pkgs.buildEnv { name = "system-fonts"; paths = config.fonts.packages; pathsToLink = ["/share/fonts"]; }; in { - # Create an FHS mount to support flatpak host icons/fonts - "/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons"); - "/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts"); + "/usr/share/icons" = mkRoSymBind "${aggregatedIcons}/share/icons"; + "/usr/local/share/fonts" = mkRoSymBind "${aggregatedFonts}/share/fonts"; + }; + + fonts = { + fontDir.enable = true; + packages = + (with pkgs; [ + noto-fonts + noto-fonts-emoji + noto-fonts-cjk + ]) + ++ lib.optionals (config.stylix.enable) [ + config.stylix.fonts.sansSerif.package + config.stylix.fonts.monospace.package + config.stylix.fonts.serif.package + ]; }; - fonts.fontDir.enable = true; services.flatpak.enable = true; system.fsPackages = [pkgs.bindfs]; xdg.portal.enable = true;