Files
lhns--steam-frame-nix/modules/portal.nix
T
Pierre Kisters 1ad0dd751e modules/cleanup.nix: orphan cleanup on every switch
Every module imports cleanup.nix (also exported as
homeManagerModules.cleanup), which
- puts steam-frame-nix-cleanup (install.sh cleanup) on PATH;
- runs `cleanup --orphans --quiet` after linkGeneration on every switch,
  keeping what the configuration still uses (steamFrame.cleanup.keep, set
  by the modules: debugger while steamvrDebugger is on, the Firefox desktop
  profile's user.js while its fix applies); in a dry run it runs with
  --dry-run;
- runs `cleanup --all` instead when Home Manager's `uninstall = true;` is
  set (the manual uninstall route);
- removes links of older versions at paths Home Manager is about to own
  before checkLinkTargets (steamFrame.cleanup.migrateLinks), which would
  count as collisions otherwise.

install.sh cleanup gains --quiet (only actions, deferrals and warnings;
the header only when something is printed). The Jellyfin module's own
removal of the old shim copy goes: cleanup does it.
2026-09-29 00:01:30 +02:00

44 lines
1.5 KiB
Nix

# Workaround (SteamOS 0.3.0, build 20260922): the Steam session's portal dir
# /usr/share/xdg-desktop-portal/gamescope-portals has backends but no
# gamescope-portals.conf, so no backend is selected and there is no OpenURI
# (links don't open). We point it at our own dir: Valve's .portal files + a
# config. Remove once SteamOS ships the .conf.
{ config, lib, ... }:
let
sys = "/usr/share/xdg-desktop-portal/gamescope-portals";
dir = "xdg-desktop-portal/gamescope-portals";
in {
imports = [
./cleanup.nix
(lib.mkRenamedOptionModule
[ "steamFrame" "portalFix" "enable" ]
[ "steamFrame" "session" "portalFix" "enable" ])
];
options.steamFrame.session.portalFix.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Give the Steam session's xdg-desktop-portal a config so apps there can
open links (OpenURI).
'';
};
config = lib.mkIf config.steamFrame.session.portalFix.enable {
xdg.dataFile."${dir}/holo.portal".source =
config.lib.file.mkOutOfStoreSymlink "${sys}/holo.portal";
xdg.dataFile."${dir}/gamescope.portal".source =
config.lib.file.mkOutOfStoreSymlink "${sys}/gamescope.portal";
xdg.dataFile."${dir}/gamescope-portals.conf".text = ''
[preferred]
default=holo;gamescope
'';
# Outer (systemd) portal only; the nested desktop's keeps kde-portals.conf.
xdg.configFile."systemd/user/xdg-desktop-portal.service.d/gamescope-portals.conf".text = ''
[Service]
Environment=XDG_DESKTOP_PORTAL_DIR=%h/.local/share/${dir}
'';
};
}