diff --git a/modules/nixos/services/flatpak/default.nix b/modules/nixos/services/flatpak/default.nix index de25cd66b..4e9bb347c 100644 --- a/modules/nixos/services/flatpak/default.nix +++ b/modules/nixos/services/flatpak/default.nix @@ -2,7 +2,6 @@ config, lib, namespace, - pkgs, ... }: let @@ -15,15 +14,18 @@ in options.${namespace}.services.flatpak = { enable = mkBoolOpt false "Whether or not to enable flatpak support."; extraRepos = lib.mkOption { - default = { - flathub = "https://flathub.org/repo/flathub.flatpakrepo"; - }; - type = lib.types.attrsOf lib.types.str; + default = [ + { + name = "flathub-beta"; + location = "https://flathub.org/beta-repo/flathub-beta.flatpakrepo"; + } + ]; + type = lib.types.listOf (lib.types.attrsOf lib.types.str); description = "Extra flatpak repositories to add."; }; - extraRefs = lib.mkOption { + extraPackages = lib.mkOption { default = [ ]; - type = lib.types.listOf lib.types.str; + type = lib.types.listOf (lib.types.either lib.types.str (lib.types.attrsOf lib.types.anything)); description = "Flatpaks to install."; example = [ "https://sober.vinegarhq.org/sober.flatpakref" @@ -32,39 +34,11 @@ in }; config = mkIf cfg.enable { - services.flatpak.enable = true; - systemd.services = { - flatpak-repos = lib.mkIf (cfg.extraRepos != { }) { + services.flatpak = { + enable = true; - wantedBy = [ "multi-user.target" ]; - path = [ pkgs.flatpak ]; - script = - let - generateRepoScript = - repos: - lib.concatStringsSep "\n" ( - lib.mapAttrsToList (name: url: '' - flatpak remote-add --if-not-exists ${name} ${url} - '') repos - ); - in - generateRepoScript cfg.extraRepos; - }; - flatpak-refs = lib.mkIf (cfg.extraRefs != [ ]) { - wantedBy = [ "multi-user.target" ]; - path = [ pkgs.flatpak ]; - script = - let - generateRepoScript = - repos: - lib.concatStringsSep "\n" ( - lib.map (url: '' - flatpak install --system ${url} - '') repos - ); - in - generateRepoScript cfg.extraRefs; - }; + remotes = cfg.extraRepos; + packages = cfg.extraPackages; }; }; }