config/profiles/desktop/flatpak.nix

27 lines
875 B
Nix
Raw Normal View History

2023-03-12 05:14:28 +01:00
{ config, pkgs, ... }:
{
services.flatpak.enable = true;
# fix missing fonts in flatpak, without resorting to copying fonts to a dedicated folder
# via https://github.com/NixOS/nixpkgs/issues/119433#issuecomment-1326957279
system.fsPackages = [ pkgs.bindfs ];
fileSystems = let
mkRoSymBind = path: {
device = path;
fsType = "fuse.bindfs";
# resolve-symlinks enable not mounting /nix into the flatpacks
options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ];
};
aggregatedFonts = pkgs.buildEnv {
name = "system-fonts";
paths = config.fonts.fonts;
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");
};
}