diff --git a/system/host/configuration.nix b/system/host/configuration.nix index 945e215..78ad617 100644 --- a/system/host/configuration.nix +++ b/system/host/configuration.nix @@ -57,6 +57,14 @@ in # Change the default text editor. Options are "emacs", "nano", or "vim". editor = "nano"; + ui.flatpak = { + # Enable Flatpak support. + enable = false; + + # Define Flatpak packages to install. + packages = [ ]; + }; + # Additional system packages to install. packages = [ ]; diff --git a/system/modules/ui/desktops/kde.nix b/system/modules/ui/desktops/kde.nix index c1b7d35..d5b6f32 100644 --- a/system/modules/ui/desktops/kde.nix +++ b/system/modules/ui/desktops/kde.nix @@ -20,6 +20,15 @@ in config = lib.mkIf cfg.enable { aux.system.ui.desktops.enable = true; + programs.dconf.enable = true; + + # Fix blank messages in KMail. See https://nixos.wiki/wiki/KDE#KMail_Renders_Blank_Messages + environment.sessionVariables = { + NIX_PROFILES = "${pkgs.lib.concatStringsSep " " ( + pkgs.lib.reverseList config.environment.profiles + )}"; + }; + services = { displayManager.sddm.enable = true; desktopManager.plasma6.enable = true; diff --git a/system/modules/ui/flatpak.nix b/system/modules/ui/flatpak.nix new file mode 100644 index 0000000..0474338 --- /dev/null +++ b/system/modules/ui/flatpak.nix @@ -0,0 +1,85 @@ +# Enable support for Flatpak applications +{ + nix-flatpak, + pkgs, + config, + lib, + ... +}: + +let + cfg = config.aux.system.ui.flatpak; +in +with lib; +{ + options = { + aux.system.ui.flatpak = { + enable = mkEnableOption (mdDoc "Enables Flatpak support."); + packages = lib.mkOption { + description = "Flatpak packages to install."; + type = lib.types.listOf lib.types.str; + default = [ ]; + example = lib.literalExpression "[ \"com.valvesoftware.Steam\" ]"; + }; + }; + }; + + config = mkIf cfg.enable { + # Enable Flatpak + services.flatpak = { + enable = true; + + # Manage all Flatpak packages and remotes + uninstallUnmanaged = true; + + # Enable automatic updates alongside nixos-rebuild + update.onActivation = true; + + # Add remote(s) + remotes = [ + { + name = "flathub"; + location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; + } + ]; + + # Install base Flatpaks. For details, see https://github.com/gmodena/nix-flatpak + packages = cfg.packages; + }; + + # 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.gnome.enable gnome.gnome-themes-extra) + (lib.mkIf config.aux.system.ui.kde.enable kdePackages.breeze-icons) + ]; + 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"; + }; + }; +}