From e553f2d5f3b39b1b99a29177fd5f4612658f1007 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 12 Jun 2026 14:50:55 +0200 Subject: refactor: stop running kodi in cage Since cage 0.2.1 Kodi didn't work anymore. With 0.2.1 it crashed which was fixed but with the fix Kodi still gives a black screen, which I reported as https://github.com/cage-kiosk/cage/issues/469. To keep it working I've been pinning cage to 0.2.0. This bug still hasn't been fixed in cage 0.3.0. Now I want to upgrade to NixOS 26.05 but that doesn't package wlroots 0.18 anymore (which is needed by cage 0.2.0). Apparently Kodi can run standalone without a display server, so let's just do that. --- nixos/hosts/ev/kodi.nix | 30 +++++++++++++++++++++++------- nixos/profiles/common/nixpkgs/overlays.nix | 20 -------------------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/nixos/hosts/ev/kodi.nix b/nixos/hosts/ev/kodi.nix index 210ddcf..27a5bd1 100644 --- a/nixos/hosts/ev/kodi.nix +++ b/nixos/hosts/ev/kodi.nix @@ -2,7 +2,7 @@ let cfg = config.kodi; - kodi-package = pkgs.kodi-wayland.withPackages (kodiPkgs: with kodiPkgs; [ + kodi-package = pkgs.kodi-gbm.withPackages (kodiPkgs: with kodiPkgs; [ joystick ]); in @@ -15,16 +15,32 @@ in config = { users.users.${cfg.user} = { - extraGroups = ["audio"]; + extraGroups = ["video" "input" "render"]; }; - services = { - cage = { - enable = true; - user = cfg.user; - program = "${kodi-package}/bin/kodi-standalone"; + hardware.graphics.enable = true; + + systemd.services.kodi-kiosk = { + description = "Kodi (GBM)"; + wantedBy = ["multi-user.target"]; + conflicts = ["getty@tty1.service"]; + after = ["systemd-user-sessions.service" "getty@tty1.service"]; + serviceConfig = { + User = cfg.user; + ExecStart = "${kodi-package}/bin/kodi-standalone"; + Restart = "always"; + PAMName = "login"; + TTYPath = "/dev/tty1"; + TTYReset = "yes"; + TTYVHangup = "yes"; + TTYVTDisallocate = "yes"; + StandardInput = "tty-fail"; + UtmpIdentifier = "tty1"; + UtmpMode = "user"; }; + }; + services = { pipewire = { enable = true; alsa.enable = true; diff --git a/nixos/profiles/common/nixpkgs/overlays.nix b/nixos/profiles/common/nixpkgs/overlays.nix index 09a2fdf..40f17a9 100644 --- a/nixos/profiles/common/nixpkgs/overlays.nix +++ b/nixos/profiles/common/nixpkgs/overlays.nix @@ -14,26 +14,6 @@ }); }) - # bug fixes - # pinning cage to v0.2.0 because kodi crashes with v0.2.1 - # (https://github.com/cage-kiosk/cage/issues/456) - (final: prev: { - cage = - (prev.cage.override { - wlroots_0_19 = prev.wlroots_0_18; - }).overrideAttrs - (oldAttrs: { - version = "0.2.0"; - src = final.fetchFromGitHub { - owner = "cage-kiosk"; - repo = "cage"; - tag = "v0.2.0"; - hash = "sha256-2SFtz62z0EF8cpFTC6wGi125MD4a5mkXqP/C+7fH+3g="; - }; - patches = []; - }); - }) - (final: prev: { sway-unwrapped = prev.sway-unwrapped.overrideAttrs (old: { patches = old.patches ++ [ -- cgit v1.3.1