1
1
Fork 0

kodi: refactor module

This commit is contained in:
Myned 2025-04-06 21:50:51 -05:00
parent 6e7300e2a1
commit e295748e1a
Signed by: Myned
GPG key ID: C7224454F7881A34
3 changed files with 25 additions and 23 deletions
options/custom
desktops/kodi
programs
profiles/console

View file

@ -11,14 +11,12 @@ in {
};
config = mkIf cfg.enable {
custom = {
programs.kodi.enable = true;
};
custom.programs.kodi.enable = true;
services = {
displayManager.autoLogin = {
enable = true;
user = "kodi";
user = config.custom.username;
};
xserver = {
@ -31,9 +29,5 @@ in {
};
};
};
users.users.kodi = {
isNormalUser = true;
};
};
}

View file

@ -6,10 +6,15 @@
}:
with lib; let
cfg = config.custom.programs.kodi;
hm = config.home-manager.users.${config.custom.username};
in {
options.custom.programs.kodi = {
enable = mkEnableOption "kodi";
firewall = mkOption {default = false;};
firewall = mkOption {
default = false;
type = types.bool;
};
package = mkOption {
default =
@ -22,6 +27,10 @@ in {
# https://wiki.nixos.org/wiki/Kodi#Plugins
plugins = mkOption {
default = [
"joystick" # https://github.com/xbmc/peripheral.joystick
"sendtokodi" # https://github.com/firsttris/plugin.video.sendtokodi
"sponsorblock" # https://github.com/siku2/script.service.sponsorblock
"trakt" # https://github.com/trakt/script.trakt
"youtube" # https://github.com/anxdpanic/plugin.video.youtube
];
@ -33,7 +42,7 @@ in {
# https://kodi.wiki/view/Smartphone/tablet_remotes#Firewall
# https://wiki.nixos.org/wiki/Kodi#Access_from_other_machines
networking.firewall = mkIf cfg.firewall {
allowedTCPPorts = [8080];
allowedTCPPorts = [8888];
allowedUDPPorts = [9777];
};
@ -46,21 +55,19 @@ in {
programs.kodi = {
enable = true;
package = cfg.package;
};
# advancedsettings.xml
# https://kodi.wiki/view/Advancedsettings.xml
settings = {
# guisettings.xml
# https://kodi.wiki/view/Advancedsettings.xml#guisettings.xml_Setting_Conversion
# https://github.com/xbmc/xbmc/blob/master/system/settings/settings.xml
# https://kodi.wiki/view/Webserver
services = {
webserver = "true";
webserverauthentication = "false";
webserverport = "8888";
};
#!! Imperative synced files
# https://kodi.wiki/view/Advancedsettings.xml
# https://kodi.wiki/view/Advancedsettings.xml#guisettings.xml_Setting_Conversion
# https://github.com/xbmc/xbmc/blob/master/system/settings/settings.xml
home.file = let
sync = source: {
source = hm.lib.file.mkOutOfStoreSymlink "${config.custom.sync}/${source}";
force = true;
};
in {
".kodi/userdata" = sync "common/config/kodi/userdata";
};
}
];

View file

@ -26,6 +26,7 @@
folders =
lib.getAttrs [
"SYNC/.ignore"
"SYNC/common"
"SYNC/game"
]
options.custom.services.syncthing.folders.default;