fix fonts for flatpaks

This commit is contained in:
2026-03-18 08:46:11 +01:00
parent 9de8e3133f
commit 03df47b6f5

View File

@@ -20,4 +20,48 @@
enable = true; enable = true;
pulse.enable = true; pulse.enable = true;
}; };
system.fsPackages = [ pkgs.bindfs ];
fileSystems = let
mkRoSymBind = path: {
device = path;
fsType = "fuse.bindfs";
options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ];
};
fontsPkgs = config.fonts.packages;
x11Fonts = pkgs.runCommand "X11-fonts"
{
preferLocalBuild = true;
nativeBuildInputs = with pkgs; [
gzip
xorg.mkfontscale
xorg.mkfontdir
];
}
(''
mkdir -p "$out/share/fonts"
font_regexp='.*\.\(ttf\|ttc\|otb\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?'
''
+ (builtins.concatStringsSep "\n" (builtins.map (pkg: ''
find ${toString pkg} -regex "$font_regexp" \
-exec ln -sf -t "$out/share/fonts" '{}' \;
'') fontsPkgs
))
+ ''
cd "$out/share/fonts"
mkfontscale
mkfontdir
cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
'');
aggregatedIcons = pkgs.buildEnv {
name = "system-icons";
paths = fontsPkgs;
pathsToLink = [
"/share/icons"
];
};
in {
"/usr/share/icons" = mkRoSymBind (aggregatedIcons + "/share/icons");
"/usr/share/fonts" = mkRoSymBind (x11Fonts + "/share/fonts");
};
} }