nixpkgs/nixos/modules/services/x11/desktop-managers/kodi.nix
h7x4 0a37316d6c
treewide: use mkPackageOption
This commit replaces a lot of usages of `mkOption` with the package
type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-27 01:28:36 +01:00

36 lines
768 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.xserver.desktopManager.kodi;
in
{
options = {
services.xserver.desktopManager.kodi = {
enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc "Enable the kodi multimedia center.";
};
package = mkPackageOption pkgs "kodi" {
example = "kodi.withPackages (p: with p; [ jellyfin pvr-iptvsimple vfs-sftp ])";
};
};
};
config = mkIf cfg.enable {
services.xserver.desktopManager.session = [{
name = "kodi";
start = ''
LIRC_SOCKET_PATH=/run/lirc/lircd ${cfg.package}/bin/kodi --standalone &
waitPID=$!
'';
}];
environment.systemPackages = [ cfg.package ];
};
}