From f22ff0e286db04e5598ff250b412770b8f5ca9ed Mon Sep 17 00:00:00 2001 From: John Ogle Date: Sun, 8 Sep 2024 12:04:35 -0700 Subject: [PATCH] [kodi] Add wayland option --- machines/boxy/configuration.nix | 2 +- machines/z790prors/configuration.nix | 2 +- roles/kodi/default.nix | 55 +++++++++++++++++++--------- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/machines/boxy/configuration.nix b/machines/boxy/configuration.nix index bbae7d2..ff5e39f 100644 --- a/machines/boxy/configuration.nix +++ b/machines/boxy/configuration.nix @@ -10,7 +10,7 @@ ./hardware-configuration.nix ../../roles/common/default.nix ../../roles/nix/default.nix - (import ../../roles/kodi/default.nix { autologin = true; inherit lib; inherit pkgs; }) + (import ../../roles/kodi/default.nix { autologin = true; wayland = true; inherit lib; inherit pkgs; }) (import ../../roles/users/default.nix { extraGroups = []; }) ]; diff --git a/machines/z790prors/configuration.nix b/machines/z790prors/configuration.nix index 56762a0..d8768eb 100644 --- a/machines/z790prors/configuration.nix +++ b/machines/z790prors/configuration.nix @@ -11,7 +11,7 @@ ../../roles/common/default.nix (import ../../roles/desktop/default.nix { x11Only = true; inherit inputs; inherit pkgs; }) ../../roles/kids/default.nix - (import ../../roles/kodi/default.nix { autologin = false; inherit lib; inherit pkgs; }) + (import ../../roles/kodi/default.nix { autologin = false; wayland = false; inherit lib; inherit pkgs; }) ../../roles/nfs-mounts/default.nix ../../roles/nix/default.nix ../../roles/printing/default.nix diff --git a/roles/kodi/default.nix b/roles/kodi/default.nix index c19fac7..6d3fce8 100644 --- a/roles/kodi/default.nix +++ b/roles/kodi/default.nix @@ -1,13 +1,17 @@ -{ autologin ? false, pkgs, ... }: +{ autologin ? false, wayland ? false, lib, pkgs, ... }: +with lib; + +let + kodiBasePkg = if wayland then pkgs.kodi-wayland else pkgs.kodi; + kodiPkg = kodiBasePkg.withPackages (pkgs: with pkgs; [ + jellyfin + steam-launcher + steam-library + youtube + ]); +in { - services.xserver.enable = true; - services.xserver.desktopManager.kodi = { - enable = true; - package = pkgs.kodi.withPackages (pkgs: with pkgs; [ - jellyfin - ]); - }; users.extraUsers.kodi.isNormalUser = true; networking.firewall = { @@ -15,14 +19,29 @@ allowedUDPPorts = [ 8080 ]; }; - services.displayManager = if autologin then { - autoLogin.enable = true; - autoLogin.user = "kodi"; - defaultSession = "kodi"; - sessionData.autologinSession = "kodi"; - } else {}; - services.xserver.displayManager = if autologin then { - lightdm.enable = true; - lightdm.greeter.enable = false; - } else {}; + services = mkIf autologin { + cage = mkIf wayland { + user = "kodi"; + program = "${kodiPkg}/bin/kodi-standalone"; + enable = true; + }; + + xserver = mkIf (!wayland) { + enable = true; + desktopManager.kodi = { + enable = true; + package = kodiPkg; + }; + displayManager.lightdm = { + enable = true; + greeter.enable = false; + }; + }; + displayManager = mkIf (!wayland) { + autoLogin.enable = true; + autoLogin.user = "kodi"; + defaultSession = "kodi"; + sessionData.autologinSession = "kodi"; + }; + }; }