feat(servers): make use of nvidia gpu for jellyfin
All checks were successful
Discord / discord commits (push) Successful in 36s

This commit is contained in:
matt1432 2024-03-02 23:36:07 -05:00
parent 21c94df25a
commit 7123e47119
2 changed files with 54 additions and 7 deletions

View file

@ -1,13 +1,14 @@
{
config,
modulesPath,
pkgs,
...
}: {
nixpkgs.hostPlatform = "x86_64-linux";
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
kernelModules = ["kvm-intel"];
kernelModules = ["kvm-intel" "nvidia-uvm"];
initrd.availableKernelModules = [
"xhci_pci"
@ -45,4 +46,41 @@
zramSwap.enable = true;
hardware.cpu.intel.updateMicrocode = config.hardware.enableRedistributableFirmware;
# NVIDIA settings
services.xserver.videoDrivers = ["nvidia"];
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
vaapiVdpau
libvdpau-va-gl
nvidia-vaapi-driver
];
extraPackages32 = with pkgs; [vaapiVdpau];
};
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = false;
# Vulkan is much more stable in Wayland
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
environment.systemPackages = with pkgs; [
libva-utils
nvidia-vaapi-driver
nvtop-nvidia
pciutils
vdpauinfo
cudaPackages.cudatoolkit
];
}

View file

@ -1,15 +1,24 @@
{
pkgs,
config,
lib,
pkgs,
...
}: let
inherit (lib) hasAttr optionals;
in {
environment.systemPackages = [
pkgs.jellyfin
pkgs.jellyfin-ffmpeg
(pkgs.jellyfin-web.overrideAttrs (_: o: {
isNvidia = config.hardware.nvidia.modesetting.enable;
jellyPkgs =
if isNvidia
then pkgs.cudaPackages.pkgs
else pkgs;
in {
services.jellyfin.package = jellyPkgs.jellyfin;
environment.systemPackages = [
jellyPkgs.jellyfin
jellyPkgs.jellyfin-ffmpeg
(jellyPkgs.jellyfin-web.overrideAttrs (_: o: {
patches =
[
(pkgs.fetchpatch {