From 0d3bf298666d84adc7f7fa42a5b83c2a2164b2e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Barnouin?= Date: Mon, 14 Apr 2025 11:48:47 +0200 Subject: [PATCH] Try to get NixOS Jellyfin to work --- flake.lock | 12 +++--- services/jellyfin/default.nix | 63 +++++++++++++++++++++--------- services/minimalConfig/default.nix | 2 +- 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/flake.lock b/flake.lock index edab3b2..8658e30 100644 --- a/flake.lock +++ b/flake.lock @@ -169,11 +169,11 @@ ] }, "locked": { - "lastModified": 1743387206, - "narHash": "sha256-24N3NAuZZbYqZ39NgToZgHUw6M7xHrtrAm18kv0+2Wo=", + "lastModified": 1744117652, + "narHash": "sha256-t7dFCDl4vIOOUMhEZnJF15aAzkpaup9x4ZRGToDFYWI=", "owner": "nix-community", "repo": "home-manager", - "rev": "15c5f9d04fabd176f30286c8f52bbdb2c853a146", + "rev": "b4e98224ad1336751a2ac7493967a4c9f6d9cb3f", "type": "github" }, "original": { @@ -201,11 +201,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1743576891, - "narHash": "sha256-vXiKURtntURybE6FMNFAVpRPr8+e8KoLPrYs9TGuAKc=", + "lastModified": 1744309437, + "narHash": "sha256-QZnNHM823am8apCqKSPdtnzPGTy2ZB4zIXOVoBp5+W0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "44a69ed688786e98a101f02b712c313f1ade37ab", + "rev": "f9ebe33a928b5d529c895202263a5ce46bdf12f7", "type": "github" }, "original": { diff --git a/services/jellyfin/default.nix b/services/jellyfin/default.nix index a6f3839..848acae 100644 --- a/services/jellyfin/default.nix +++ b/services/jellyfin/default.nix @@ -10,26 +10,53 @@ in { enable = lib.mkEnableOption "Enable minimal config"; }; config = lib.mkIf cfg.enable { - environment.systemPackages = [pkgs.cifs-utils]; - # Intel Hardware Acceleration config - nixpkgs.config.packageOverrides = pkgs: { - vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; - }; - hardware.graphics = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver - intel-vaapi-driver # previously vaapiIntel - vaapiVdpau - libvdpau-va-gl - intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in) - vpl-gpu-rt # QSV on 11th gen or newer + systemd.services.jellyfin.environment.LIBVA_DRIVER_NAME = "iHD"; + environment = { + sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; + systemPackages = with pkgs; [ + cifs-utils + intel-gpu-tools ]; }; - services.jellyfin = { - enable = true; - user = "tbarnouin"; - openFirewall = true; + # Intel Hardware Acceleration config + hardware = { + intel-gpu-tools.enable = true; + graphics = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + vaapiVdpau + libvdpau-va-gl + intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in) + vpl-gpu-rt # QSV on 11th gen or newer + ]; + extraPackages32 = with pkgs.pkgsi686Linux; [ + intel-media-driver + ]; + }; + }; + services = { + crowdsec = { + hub.collections = [ + "LePresidente/jellyfin" + ]; + localConfig = { + acquisitions = [ + { + source = "journalctl"; + journalctl_filter = [ "_SYSTEMD_UNIT=jellyfin.service" ]; + labels = { + type = "syslog"; + }; + } + ]; + }; + }; + jellyfin= { + enable = true; + user = "tbarnouin"; + openFirewall = true; + }; }; fileSystems."/mnt/media" = { device = "192.168.1.125:/BIGDATA"; diff --git a/services/minimalConfig/default.nix b/services/minimalConfig/default.nix index d46bc57..d90a32e 100644 --- a/services/minimalConfig/default.nix +++ b/services/minimalConfig/default.nix @@ -40,7 +40,7 @@ users = { users.tbarnouin = { isNormalUser = true; - extraGroups = ["wheel"]; + extraGroups = ["wheel" "video" "render"]; shell = pkgs.zsh; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos"