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.
This commit is contained in:
Pierre Kisters committed 2026-09-29 00:01:30 +02:00
1 parent 7255315b73
commit 1ad0dd751e
18 files changed
+115 -29

No files matched your search

+3 -11
View File
@@ -31,6 +31,8 @@ let
"${key}=${if lib.isList value then lib.concatMapStrings (v: "${v};") value else value}\n") entries))
override));
in {
imports = [ ./cleanup.nix ];
options.steamFrame.jellyfin.hardwareDecoding = {
enable = lib.mkOption {
type = lib.types.bool;
@@ -55,18 +57,8 @@ in {
};
};
# The shim copy of earlier versions is removed by steam-frame-nix-cleanup.
config = lib.mkMerge [
{
# Remove the shim copy of earlier versions (copied into the app's data
# dir, marked in $XDG_STATE_HOME/steam-frame-nix).
home.activation.steamFrameJellyfinHwdec = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
marker="''${XDG_STATE_HOME:-$HOME/.local/state}/steam-frame-nix/jellyfin-hwdec-shim"
if [ -e "$marker" ]; then
run rm -f "$HOME/.var/app/${app}/mpv-hwdec-shim.so" "$marker"
run rmdir --ignore-fail-on-non-empty "''${marker%/*}"
fi
'';
}
(lib.mkIf (cfg.enable && !useNixFlatpak) {
# force: `flatpak override --user` replaces the link with a file.
xdg.dataFile."flatpak/overrides/${app}" = { source = overrideFile; force = true; };