flatpak font workarounds

This commit is contained in:
2025-01-06 17:51:08 -08:00
parent d7c234db82
commit 0fdd9efff2
5 changed files with 67 additions and 44 deletions

5
modules/default.nix Normal file
View File

@@ -0,0 +1,5 @@
{...}: {
imports = [
./workarounds
];
}

View File

@@ -0,0 +1,5 @@
{
imports = [
./flatpak.nix
];
}

View File

@@ -0,0 +1,44 @@
# https://github.com/knightpp/nixos-cfg/blob/main/modules/workarounds/flatpak.nix
{
pkgs,
config,
lib,
...
}: let
cfg = config.workarounds.flatpak;
in {
options = {
workarounds.flatpak = {
enable = lib.mkEnableOption "flatpak workaround";
};
};
config = lib.mkIf cfg.enable {
system.fsPackages = [pkgs.bindfs];
fileSystems = let
mkRoSymBind = path: {
device = path;
fsType = "fuse.bindfs";
options = ["ro" "resolve-symlinks" "x-gvfs-hide"];
};
aggregated = pkgs.buildEnv {
name = "system-fonts-and-icons";
paths = builtins.attrValues {
inherit (pkgs.libsForQt5) breeze-qt5;
inherit
(pkgs)
noto-fonts
noto-fonts-emoji
noto-fonts-cjk-sans
noto-fonts-cjk-serif
;
};
pathsToLink = ["/share/fonts" "/share/icons"];
};
in {
# Create an FHS mount to support flatpak host icons/fonts
"/usr/share/icons" = mkRoSymBind "${aggregated}/share/icons";
"/usr/share/fonts" = mkRoSymBind "${aggregated}/share/fonts";
};
};
}