48 lines
1003 B
Nix
48 lines
1003 B
Nix
{ 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
|
|
{
|
|
users.extraUsers.kodi.isNormalUser = true;
|
|
|
|
networking.firewall = {
|
|
allowedTCPPorts = [ 8080 ];
|
|
allowedUDPPorts = [ 8080 ];
|
|
};
|
|
|
|
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";
|
|
};
|
|
};
|
|
}
|