config/profiles/desktop/flatpak.nix

33 lines
1.0 KiB
Nix

{ config, pkgs, ... }:
{
services.flatpak.enable = true;
# TODO: integrate into gnome-software
# TODO: somehow run this, like i do in home-manager
# flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# 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");
};
}