Merge branch 'jellyfin-stateless' into 'master'
Towards Stateless Jellyfin Closes #39 See merge request private-void/depot!48
This commit is contained in:
commit
40dcac1931
4 changed files with 59 additions and 9 deletions
|
@ -24,13 +24,17 @@ with tools.nginx;
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.intel-media-driver;
|
package = pkgs.intel-media-driver;
|
||||||
};
|
};
|
||||||
systemd.services.jellyfin.serviceConfig = {
|
systemd.services.jellyfin = {
|
||||||
# allow access to GPUs for hardware transcoding
|
# if EncoderAppPath is manually set in the web UI, it can never be updated through --ffmpeg
|
||||||
DeviceAllow = lib.mkForce "char-drm";
|
preStart = "test ! -e /var/lib/jellyfin/config/encoding.xml || sed -i '/<EncoderAppPath>/d' /var/lib/jellyfin/config/encoding.xml";
|
||||||
BindPaths = lib.mkForce "/dev/dri";
|
serviceConfig = {
|
||||||
# to allow restarting from web ui
|
# allow access to GPUs for hardware transcoding
|
||||||
Restart = lib.mkForce "always";
|
DeviceAllow = lib.mkForce "char-drm";
|
||||||
|
BindPaths = lib.mkForce "/dev/dri";
|
||||||
|
# to allow restarting from web ui
|
||||||
|
Restart = lib.mkForce "always";
|
||||||
|
|
||||||
Slice = "mediaplayback.slice";
|
Slice = "mediaplayback.slice";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
{ self, ... }:
|
{ lib, self, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
perSystem = { filters, pkgs, self', ... }: {
|
perSystem = { filters, pkgs, self', ... }: let
|
||||||
|
fakeCluster = import ../../cluster {
|
||||||
|
inherit lib;
|
||||||
|
hostName = throw "not available in test environment";
|
||||||
|
depot = throw "not available in test environment";
|
||||||
|
};
|
||||||
|
in {
|
||||||
checks = filters.doFilter filters.checks {
|
checks = filters.doFilter filters.checks {
|
||||||
|
jellyfin-stateless = pkgs.callPackage ./jellyfin-stateless.nix {
|
||||||
|
inherit (self'.packages) jellyfin;
|
||||||
|
inherit fakeCluster;
|
||||||
|
};
|
||||||
|
|
||||||
keycloak = pkgs.callPackage ./keycloak-custom-jre.nix {
|
keycloak = pkgs.callPackage ./keycloak-custom-jre.nix {
|
||||||
jre = self'.packages.jre17_standard;
|
jre = self'.packages.jre17_standard;
|
||||||
};
|
};
|
||||||
|
|
34
packages/checks/jellyfin-stateless.nix
Normal file
34
packages/checks/jellyfin-stateless.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{ nixosTest, fakeCluster, jellyfin }:
|
||||||
|
|
||||||
|
nixosTest {
|
||||||
|
name = "jellyfin-stateless";
|
||||||
|
nodes = {
|
||||||
|
machine = {
|
||||||
|
imports = fakeCluster.config.services.warehouse.nixos.host;
|
||||||
|
|
||||||
|
_module.args.depot.packages.jellyfin = jellyfin;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
testScript = /*python*/ ''
|
||||||
|
def start_jf():
|
||||||
|
machine.succeed("systemctl start jellyfin.service")
|
||||||
|
machine.wait_for_unit("jellyfin.service")
|
||||||
|
machine.wait_for_open_port(8096)
|
||||||
|
machine.wait_until_succeeds("curl --fail http://127.0.0.1:8096")
|
||||||
|
|
||||||
|
def stop_jf():
|
||||||
|
machine.succeed("systemctl stop jellyfin.service")
|
||||||
|
|
||||||
|
machine.wait_for_unit("jellyfin.service")
|
||||||
|
|
||||||
|
start_jf()
|
||||||
|
machine.succeed("sed -i 's,EncoderAppPathDisplay,EncoderAppPath,g' /var/lib/jellyfin/config/encoding.xml")
|
||||||
|
machine.succeed("sed -i 's,<EncoderAppPath>.*</EncoderAppPath>,<EncoderAppPath>/FAKE/bin/ffmpeg</EncoderAppPath>,g' /var/lib/jellyfin/config/encoding.xml")
|
||||||
|
stop_jf()
|
||||||
|
start_jf()
|
||||||
|
|
||||||
|
with subtest("should reset to real ffmpeg"):
|
||||||
|
machine.fail("grep -q '/FAKE/bin/ffmpeg' /var/lib/jellyfin/config/encoding.xml")
|
||||||
|
machine.succeed("grep -q '/nix/store/.*/bin/ffmpeg' /var/lib/jellyfin/config/encoding.xml")
|
||||||
|
'';
|
||||||
|
}
|
|
@ -12,6 +12,7 @@
|
||||||
tempo = [ "x86_64-linux" ];
|
tempo = [ "x86_64-linux" ];
|
||||||
};
|
};
|
||||||
checks = {
|
checks = {
|
||||||
|
jellyfin-stateless = [ "x86_64-linux" ];
|
||||||
keycloak = [ "x86_64-linux" ];
|
keycloak = [ "x86_64-linux" ];
|
||||||
patroni = [ "x86_64-linux" ];
|
patroni = [ "x86_64-linux" ];
|
||||||
searxng = [ "x86_64-linux" ];
|
searxng = [ "x86_64-linux" ];
|
||||||
|
|
Loading…
Reference in a new issue