nixos-config/configs/porani/kodi.nix

49 lines
1.1 KiB
Nix

{ config, lib, pkgs, ... }:
{
services.xserver = {
enable = true;
autorun = true;
desktopManager = {
kodi.enable = true;
default = "kodi";
xterm.enable = false;
};
displayManager.lightdm = {
enable = true;
autoLogin.enable = true;
autoLogin.user = config.users.users.kodi.name;
# todo test it
# if kodi crashes restart the whole xsession to trigger the login
extraConfig = let
restartScript = pkgs.writers.writeBash "cleanup"
''
trap "" SIGHUP SIGINT SIGTERM
${pkgs.systemd}/bin/systemctl restart display-manager.service
'';
in
''
session-cleanup-script=${restartScript}
'';
};
};
users = {
# mutableUsers = true;
users.kodi= {
isNormalUser = true;
name = "kodi";
uid = 1338;
initialPassword = lib.fileContents <secrets/kodi/password>;
};
};
# allow everybody in the net to access the wifi
networking.firewall = {
allowedTCPPorts = [ 8080 ];
allowedUDPPorts = [ 8080 ];
};
}