1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.services.xserver.desktopManager.kodi;
7in
8
9{
10 options = {
11 services.xserver.desktopManager.kodi = {
12 enable = mkOption {
13 type = types.bool;
14 default = false;
15 description = "Enable the kodi multimedia center.";
16 };
17
18 package = mkOption {
19 type = types.package;
20 default = pkgs.kodi;
21 defaultText = "pkgs.kodi";
22 example = "pkgs.kodi.withPackages (p: with p; [ jellyfin pvr-iptvsimple vfs-sftp ])";
23 description = ''
24 Package that should be used for Kodi.
25 '';
26 };
27 };
28 };
29
30 config = mkIf cfg.enable {
31 services.xserver.desktopManager.session = [{
32 name = "kodi";
33 start = ''
34 LIRC_SOCKET_PATH=/run/lirc/lircd ${cfg.package}/bin/kodi --standalone &
35 waitPID=$!
36 '';
37 }];
38
39 environment.systemPackages = [ cfg.package ];
40 };
41}