diff --git a/flake.in.nix b/flake.in.nix index ff47658..d6328b5 100644 --- a/flake.in.nix +++ b/flake.in.nix @@ -140,7 +140,6 @@ inputs.arion.nixosModules.arion inputs.disko.nixosModules.disko inputs.fw-fanctrl.nixosModules.default - inputs.nix-flatpak.nixosModules.nix-flatpak ]; home-manager.users.${config.custom.username}.imports = [ diff --git a/options/custom/services/flatpak.nix b/options/custom/services/flatpak.nix index 54f6158..445fa12 100644 --- a/options/custom/services/flatpak.nix +++ b/options/custom/services/flatpak.nix @@ -11,32 +11,52 @@ in { options.custom.services.flatpak.enable = mkOption {default = false;}; config = mkIf cfg.enable { - # https://wiki.nixos.org/wiki/Flatpak - # https://github.com/gmodena/nix-flatpak - services.flatpak = { - enable = true; - uninstallUnmanaged = true; # Immutable flatpaks - update.auto.enable = true; # Auto update flatpaks weekly + services.flatpak.enable = true; - #!! Installation occurs in background as a oneshot service - #?? flatpak search NAME - packages = - optionals config.custom.default [ - "com.github.tchx84.Flatseal" - ] - ++ optionals config.custom.minimal [ - "net.retrodeck.retrodeck" - ] - ++ optionals config.custom.full [ - "app.drey.Biblioteca" - ]; + #!! Only takes effect if /usr/* shares do not exist + # Nixpkgs workaround requires packages in the global environment + # https://github.com/NixOS/nixpkgs/pull/262462 + environment.systemPackages = + config.fonts.packages + ++ [ + config.home-manager.users.${config.custom.username}.gtk.cursorTheme.package + config.home-manager.users.${config.custom.username}.gtk.iconTheme.package + ]; + + home-manager.users.${config.custom.username} = { + imports = [inputs.nix-flatpak.homeManagerModules.nix-flatpak]; + + # https://wiki.nixos.org/wiki/Flatpak + # https://github.com/gmodena/nix-flatpak + services.flatpak = { + enable = true; + uninstallUnmanaged = true; # Immutable flatpaks + update.auto.enable = true; # Auto update flatpaks weekly + + #!! Installation occurs during activation + #?? flatpak search NAME + packages = + optionals config.custom.default [ + "com.github.tchx84.Flatseal" + ] + ++ optionals config.custom.minimal [ + "net.retrodeck.retrodeck" + ] + ++ optionals config.custom.full [ + "app.drey.Biblioteca" + ]; + + # https://github.com/gmodena/nix-flatpak?tab=readme-ov-file#overrides + overrides.global = { + Context.filesystems = [ + "xdg-config/gtk-3.0:ro" + "xdg-config/gtk-4.0:ro" + + # HACK: Globally allow access to /nix/store for symlinked themes + "/nix/store:ro" + ]; + }; + }; }; - - # Theme packages must be installed system-wide for flatpaks - environment.systemPackages = with pkgs; [ - adw-gtk3 - google-cursor - papirus-icon-theme - ]; }; }