nixcfg/nixosModules/apps/flatpak/default.nix

39 lines
1 KiB
Nix
Raw Normal View History

2024-04-07 22:16:33 -04:00
{
pkgs,
lib,
config,
...
}: {
options = {
2024-03-28 16:40:23 -04:00
apps.flatpak.enable =
lib.mkEnableOption "Enables flatpak support with GUI.";
};
config = lib.mkIf config.apps.flatpak.enable {
# Needed for Flatpaks
xdg.portal.enable = true;
services.flatpak.enable = true;
fonts.fontDir.enable = true;
# Allow access to system fonts.
2024-04-07 22:16:33 -04:00
system.fsPackages = [pkgs.bindfs];
fileSystems = let
mkRoSymBind = path: {
device = path;
fsType = "fuse.bindfs";
2024-04-07 22:16:33 -04:00
options = ["ro" "resolve-symlinks" "x-gvfs-hide"];
};
aggregatedFonts = pkgs.buildEnv {
name = "system-fonts";
paths = config.fonts.packages;
2024-04-07 22:16:33 -04:00
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");
};
2024-04-07 22:16:33 -04:00
environment.systemPackages = with pkgs; [gnome.gnome-software];
};
}