diff --git a/core/system/gaming.nix b/core/system/gaming.nix index 32ae4dc..4290d00 100644 --- a/core/system/gaming.nix +++ b/core/system/gaming.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let cfg = config.nomarchy.system.gaming; @@ -16,5 +16,29 @@ in programs.gamemode.enable = true; services.flatpak.enable = true; + + # `services.flatpak.enable = true` ships flatpak but does NOT add any + # remotes — without a remote, `flatpak install` and the Discover GUI + # can't find anything. nixpkgs has no declarative remote-add API yet, + # so we run a one-shot system unit after flatpak.service is ready that + # adds the flathub remote idempotently (`--if-not-exists`). Lives under + # the gaming preset because Pillar 5 ships flatpak as part of the + # gaming wiring; if another preset later needs flatpak, lift this to a + # dedicated module. + systemd.services.nomarchy-flathub-init = { + description = "Register the Flathub remote on first start"; + wantedBy = [ "multi-user.target" ]; + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + path = [ pkgs.flatpak ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + flatpak remote-add --if-not-exists flathub \ + https://dl.flathub.org/repo/flathub.flatpakrepo + ''; + }; }; }