nixfiles/hosts/raspberry-pi5/profiles/kodi.nix

72 lines
1.8 KiB
Nix

{pkgs, ...}: let
kodiPackage = pkgs.kodi-wayland.withPackages (kodiPkgs:
with kodiPkgs; [
pvr-iptvsimple
inputstreamhelper
inputstream-adaptive
inputstream-rtmp
visualization-projectm
visualization-waveform
visualization-matrix
visualization-starburst
visualization-spectrum
]);
gamescope-kodi = pkgs.writeShellScriptBin "gamescope-kodi" ''
gamescope --expose-wayland --hdr-enabled -- kodi --windowing=wayland
'';
gamescopeKodiSessionFile =
(pkgs.writeTextDir "share/wayland-sessions/kodi.desktop" ''
[Desktop Entry]
Name=Kodi
Comment=Kodi
Exec=${gamescope-kodi}/bin/gamescope-kodi
Type=Application
'')
.overrideAttrs (_: {passthru.providedSessions = ["kodi"];});
in {
environment.systemPackages = [
kodiPackage
];
security.wrappers.gamescope = {
owner = "root";
group = "root";
source = "${pkgs.gamescope}/bin/gamescope";
capabilities = "cap_sys_nice+pie";
};
services.displayManager.sessionPackages = [gamescopeKodiSessionFile];
services.xserver = {
enable = true;
extraConfig = ''
Section "OutputClass"
Identifier "vc4"
MatchDriver "vc4"
Driver "modesetting"
Option "PrimaryGPU" "true"
EndSection
'';
};
networking.firewall = {
allowedTCPPorts = [8080];
allowedUDPPorts = [8080];
};
home-manager.users.chaos = let
widevine = pkgs.widevine-aarch64-4k;
in {
home.file.widevine-lib = {
source = "${widevine}/share/google/chrome/WidevineCdm/_platform_specific/linux_arm64/libwidevinecdm.so";
target = ".kodi/cdm/libwidevinecdm.so";
};
home.file.widevine-manifest = {
source = "${widevine}/share/google/chrome/WidevineCdm/manifest.json";
target = ".kodi/cdm/manifest.json";
};
};
}