Flatpak: make bindfs an optional parameter
This commit is contained in:
parent
48f99d0516
commit
41b78e06f9
|
@ -79,6 +79,8 @@ in
|
||||||
"org.keepassxc.KeePassXC"
|
"org.keepassxc.KeePassXC"
|
||||||
"org.mozilla.firefox"
|
"org.mozilla.firefox"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
useBindFS = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,10 @@
|
||||||
let
|
let
|
||||||
cfg = config.aux.system.ui.flatpak;
|
cfg = config.aux.system.ui.flatpak;
|
||||||
in
|
in
|
||||||
with lib;
|
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
aux.system.ui.flatpak = {
|
aux.system.ui.flatpak = {
|
||||||
enable = mkEnableOption (mdDoc "Enables Flatpak support.");
|
enable = lib.mkEnableOption { description = "Enables Flatpak support."; };
|
||||||
packages = lib.mkOption {
|
packages = lib.mkOption {
|
||||||
description = "Flatpak packages to install.";
|
description = "Flatpak packages to install.";
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
|
@ -31,25 +30,68 @@ with lib;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
useBindFS = lib.mkEnableOption {
|
||||||
|
description = "Whether to use a BindFS mount to support custom themes and cursors. May cause performance issues.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkMerge [
|
||||||
# Enable Flatpak
|
(lib.mkIf cfg.enable {
|
||||||
services.flatpak = {
|
# Enable Flatpak
|
||||||
enable = true;
|
services.flatpak = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
# Manage all Flatpak packages and remotes
|
# Manage all Flatpak packages and remotes
|
||||||
uninstallUnmanaged = true;
|
uninstallUnmanaged = true;
|
||||||
|
|
||||||
# Enable automatic updates alongside nixos-rebuild
|
# Enable automatic updates alongside nixos-rebuild
|
||||||
update.onActivation = true;
|
update.onActivation = true;
|
||||||
|
|
||||||
# Add remote(s)
|
# Add remote(s)
|
||||||
remotes = cfg.remotes;
|
remotes = cfg.remotes;
|
||||||
|
|
||||||
# Install base Flatpaks. For details, see https://github.com/gmodena/nix-flatpak
|
# Install base Flatpaks. For details, see https://github.com/gmodena/nix-flatpak
|
||||||
packages = cfg.packages;
|
packages = cfg.packages;
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
|
(lib.mkIf cfg.useBindFS {
|
||||||
|
# Workaround for getting Flatpak apps to use system fonts, icons, and cursors
|
||||||
|
# For details (and source), see https://github.com/NixOS/nixpkgs/issues/119433#issuecomment-1767513263
|
||||||
|
# NOTE: If fonts in Flatpaks appear incorrect (like squares), run this command to regenerate the font cache:
|
||||||
|
# flatpak list --columns=application | xargs -I %s -- flatpak run --command=fc-cache %s -f -v
|
||||||
|
system.fsPackages = [ pkgs.bindfs ];
|
||||||
|
fileSystems =
|
||||||
|
let
|
||||||
|
mkRoSymBind = path: {
|
||||||
|
device = path;
|
||||||
|
fsType = "fuse.bindfs";
|
||||||
|
options = [
|
||||||
|
"ro"
|
||||||
|
"resolve-symlinks"
|
||||||
|
"x-gvfs-hide"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
aggregatedIcons = pkgs.buildEnv {
|
||||||
|
name = "system-icons";
|
||||||
|
paths = with pkgs; [
|
||||||
|
(lib.mkIf config.aux.system.ui.desktops.gnome.enable gnome-themes-extra)
|
||||||
|
(lib.mkIf config.aux.system.ui.desktops.kde.enable kdePackages.breeze-icons)
|
||||||
|
papirus-icon-theme
|
||||||
|
qogir-icon-theme
|
||||||
|
];
|
||||||
|
pathsToLink = [ "/share/icons" ];
|
||||||
|
};
|
||||||
|
aggregatedFonts = pkgs.buildEnv {
|
||||||
|
name = "system-fonts";
|
||||||
|
paths = config.fonts.packages;
|
||||||
|
pathsToLink = [ "/share/fonts" ];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
"/usr/share/icons" = mkRoSymBind "${aggregatedIcons}/share/icons";
|
||||||
|
"/usr/local/share/fonts" = mkRoSymBind "${aggregatedFonts}/share/fonts";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue