services.flatpak.enable = true (set inside core/system/gaming.nix's mkIf cfg.enable block) ships flatpak but doesn't add any remotes, so `flatpak install` and the Discover GUI returned empty results until the user ran the manual `flatpak remote-add` one-liner. nixpkgs has no declarative remote-add API yet. Added systemd.services.nomarchy-flathub-init: a Type=oneshot, RemainAfterExit=true unit that runs `flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo` after network-online.target. The --if-not-exists flag keeps it idempotent across reboots and re-runs. Lives under the gaming preset (where flatpak is wired today); lift to a dedicated module when another preset needs flatpak. Closes the "Gaming — declarative flathub remote" Next-column item. `nix flake check --no-build` clean.
45 lines
1.5 KiB
Nix
45 lines
1.5 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.nomarchy.system.gaming;
|
|
in
|
|
{
|
|
config = lib.mkIf cfg.enable {
|
|
programs.steam = {
|
|
enable = true;
|
|
remotePlay.openFirewall = lib.mkDefault true;
|
|
localNetworkGameTransfers.openFirewall = lib.mkDefault true;
|
|
};
|
|
|
|
# gamemode adjusts CPU governor and reschedules processes when a
|
|
# game requests it. The launching user must be in the `gamemode` group.
|
|
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
|
|
'';
|
|
};
|
|
};
|
|
}
|