From 1135f8c51f768cf7c2a3247a36a6dd8bc89b997c Mon Sep 17 00:00:00 2001 From: Pierre Kisters <1524059+lhns@users.noreply.github.com> Date: Mon, 28 Sep 2026 05:55:50 +0200 Subject: [PATCH] Defaults: firefox.disableAv1 on, Jellyfin hardware decoding on when nix-flatpak installs it --- README.md | 21 ++++++++++++++------- modules/firefox.nix | 25 +++++++++++++++++-------- modules/jellyfin.nix | 19 +++++++++++++------ template/home.nix | 8 +++----- 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 7eacb1c..fdc7f2d 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,6 @@ a commented version of these two files ([`template/`](template)): frameControls.enable = true; }; firefox.enable = true; - jellyfin.hardwareDecoding.enable = true; }; # Example: an app that must use the single wallet on the outer bus. @@ -258,9 +257,10 @@ without it. | `steamFrame.clipboardSync.package` | package | built from `dnut/clipboard-sync` | The clipboard-sync package. | | `steamFrame.firefox.enable` | bool | `false` | Launcher for the Flathub Firefox Flatpak with the fixes below. | | `steamFrame.firefox.vrFullscreenFix` | bool | `true` | Default `full-screen-api.ignore-widgets` to `true` (not in the desktop profile). | -| `steamFrame.firefox.prefs` | attrs of bool, int or str | `{ }` | `about:config` default values for every profile, e.g. `{ "media.av1.enabled" = false; }`. | +| `steamFrame.firefox.disableAv1` | bool | `true` | Default `media.av1.enabled` to `false`: the Frame's decoder driver has no AV1, so sites send VP9/H.264, decoded in hardware. | +| `steamFrame.firefox.prefs` | attrs of bool, int or str | `{ }` | Further `about:config` default values for every profile (override the fixes too). | | `steamFrame.firefox.desktopProfile` | null or str | `"desktop"` | Separate profile for the nested desktop; `null`: none. | -| `steamFrame.jellyfin.hardwareDecoding.enable` | bool | `false` | Hardware video decoding in the Jellyfin Desktop Flatpak, see [Jellyfin](#jellyfin-hardware-decoding-jellyfinhardwaredecoding). | +| `steamFrame.jellyfin.hardwareDecoding.enable` | bool | `true` if nix-flatpak installs Jellyfin Desktop, else `false` | Hardware video decoding in the Jellyfin Desktop Flatpak, see [Jellyfin](#jellyfin-hardware-decoding-jellyfinhardwaredecoding). | | `steamFrame.jellyfin.hardwareDecoding.hwdec` | str | `"v4l2m2m-copy,auto-copy"` | mpv `hwdec` used instead of Jellyfin's automatic one. | Renamed options still work under their old names, with a warning: @@ -811,14 +811,17 @@ associations keep working. Firefox looks frozen. `full-screen-api.ignore-widgets` makes fullscreen fill just the window. **Remove when** gamescope shows fullscreen X11 windows in VR. -- **`prefs`:** `about:config` values for every profile. E.g. - `"media.av1.enabled" = false`: the Frame's decoder has no AV1, so YouTube - and co. fall back to VP9/H.264, which it decodes in hardware. +- **`disableAv1`** (on by default): `media.av1.enabled = false`. The Frame's + decoder driver (`iris`) has no AV1, only H.264, HEVC and VP9, so YouTube + and co. send VP9/H.264, decoded in hardware, instead of software AV1. + **Remove when** a SteamOS kernel adds AV1 to `iris`. +- **`prefs`:** further `about:config` values for every profile; they can + also override the fixes above. - **`desktopProfile`:** the sessions can't see each other's Firefox, so a second instance stops at the locked profile; in the nested desktop the launcher uses this separate profile. -`prefs` and the fullscreen fix are *default* values (`pref()`), not user +`prefs` and the fixes are *default* values (`pref()`), not user values: `about:config` can still change them per profile, and nothing is written to `prefs.js`, so removing one leaves nothing behind. Firefox reads default prefs from `defaults/pref/*.js` in its system config dir, which in @@ -862,6 +865,10 @@ its store path (only that one, read-only) to the sandbox. It would work for any libmpv app that sets `hwdec=auto*`, but only Jellyfin Desktop is set up here. +On by default when nix-flatpak installs the app +(`services.flatpak.packages` contains `org.jellyfin.JellyfinDesktop`); +otherwise set `enable = true` yourself. + The override goes through nix-flatpak's `services.flatpak.overrides` if [nix-flatpak](https://github.com/gmodena/nix-flatpak) is imported and enabled (merged with your own overrides there). Without it, home-manager diff --git a/modules/firefox.nix b/modules/firefox.nix index ee1f9a8..388e6f7 100644 --- a/modules/firefox.nix +++ b/modules/firefox.nix @@ -28,7 +28,9 @@ let ffDir = "$HOME/.var/app/org.mozilla.firefox/config/mozilla/firefox"; profileDir = "${ffDir}/${cfg.desktopProfile}"; - defaultPrefs = cfg.prefs // lib.optionalAttrs cfg.vrFullscreenFix { "full-screen-api.ignore-widgets" = true; }; + defaultPrefs = lib.optionalAttrs cfg.disableAv1 { "media.av1.enabled" = false; } + // lib.optionalAttrs cfg.vrFullscreenFix { "full-screen-api.ignore-widgets" = true; } + // cfg.prefs; desktopFix = cfg.enable && cfg.vrFullscreenFix && cfg.desktopProfile != null; # Only ever this one pref (profileSync relies on it). desktopKeys = [ "full-screen-api.ignore-widgets" ]; @@ -130,17 +132,24 @@ in { Steam session. ''; }; + disableAv1 = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Default media.av1.enabled to false: the Frame's decoder driver has no + AV1 (H.264, HEVC, VP9 only), so sites like YouTube send VP9/H.264, + decoded in hardware, instead of software-decoded AV1. + ''; + }; prefs = lib.mkOption { type = with lib.types; attrsOf (oneOf [ bool int str ]); default = { }; - example = { "media.av1.enabled" = false; }; + example = { "media.autoplay.default" = 5; }; description = '' - about:config preferences for every profile (desktop one included), - as default values: about:config can still change them for a profile, - and removing one here leaves nothing behind. E.g. media.av1.enabled = - false: the Frame's decoder has no AV1, so sites like YouTube fall back - to VP9/H.264, which it decodes in hardware. Take effect at the next - start of Firefox. + Further about:config preferences for every profile (desktop one + included), as default values: about:config can still change them for + a profile, and removing one here leaves nothing behind. Override the + fixes above too. Take effect at the next start of Firefox. ''; }; desktopProfile = lib.mkOption { diff --git a/modules/jellyfin.nix b/modules/jellyfin.nix index 6b2d5a4..1756d52 100644 --- a/modules/jellyfin.nix +++ b/modules/jellyfin.nix @@ -32,12 +32,19 @@ let override)); in { options.steamFrame.jellyfin.hardwareDecoding = { - enable = lib.mkEnableOption '' - hardware video decoding (the Frame's V4L2 decoder) in the Jellyfin - Desktop Flatpak: device access for the sandbox (devices=all) and an - LD_PRELOAD shim that makes mpv try hwdec's value below. Without - nix-flatpak, home-manager owns the app's Flatpak override file. Takes - effect at the next start of Jellyfin''; + enable = lib.mkOption { + type = lib.types.bool; + default = lib.any (p: (if builtins.isString p then p else p.appId or null) == app) + (config.services.flatpak.packages or [ ]); + defaultText = lib.literalMD "`true` if nix-flatpak installs `org.jellyfin.JellyfinDesktop` (`services.flatpak.packages`), else `false`"; + description = '' + Hardware video decoding (the Frame's V4L2 decoder) in the Jellyfin + Desktop Flatpak: device access for the sandbox (devices=all) and an + LD_PRELOAD shim that makes mpv try hwdec's value below. Without + nix-flatpak, home-manager owns the app's Flatpak override file. Takes + effect at the next start of Jellyfin. + ''; + }; hwdec = lib.mkOption { type = lib.types.strMatching "[^[:space:]]+"; default = "v4l2m2m-copy,auto-copy"; diff --git a/template/home.nix b/template/home.nix index ec9ae8e..705f3e5 100644 --- a/template/home.nix +++ b/template/home.nix @@ -54,10 +54,8 @@ # frameControls.enable = true; # }; # firefox.enable = true; # launcher for the Firefox Flatpak - # # about:config defaults; the Frame decodes VP9/H.264 but not AV1: - # firefox.prefs."media.av1.enabled" = false; - # # Hardware video decoding in the Jellyfin Desktop Flatpak (install - # # org.jellyfin.JellyfinDesktop yourself); gives it devices=all: - # jellyfin.hardwareDecoding.enable = true; + # # Jellyfin Desktop Flatpak: hardware video decoding is on by itself + # # when nix-flatpak installs it; otherwise (gives it devices=all): + # # jellyfin.hardwareDecoding.enable = true; # }; }