Merge pull request #59465 from minijackson/module-jellyfin
This commit is contained in:
commit
3fce35fde2
@ -414,6 +414,7 @@
|
||||
./services/misc/ihaskell.nix
|
||||
./services/misc/irkerd.nix
|
||||
./services/misc/jackett.nix
|
||||
./services/misc/jellyfin.nix
|
||||
./services/misc/logkeys.nix
|
||||
./services/misc/leaps.nix
|
||||
./services/misc/lidarr.nix
|
||||
|
60
nixos/modules/services/misc/jellyfin.nix
Normal file
60
nixos/modules/services/misc/jellyfin.nix
Normal file
@ -0,0 +1,60 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.jellyfin;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.jellyfin = {
|
||||
enable = mkEnableOption "Jellyfin Media Server";
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "jellyfin";
|
||||
description = "User account under which Jellyfin runs.";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "jellyfin";
|
||||
description = "Group under which jellyfin runs.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.jellyfin = {
|
||||
description = "Jellyfin Media Server";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = rec {
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
StateDirectory = "jellyfin";
|
||||
CacheDirectory = "jellyfin";
|
||||
ExecStart = "${pkgs.jellyfin}/bin/jellyfin --datadir '/var/lib/${StateDirectory}' --cachedir '/var/cache/${CacheDirectory}'";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
users.users = mkIf (cfg.user == "jellyfin") {
|
||||
jellyfin.group = cfg.group;
|
||||
};
|
||||
|
||||
users.groups = mkIf (cfg.group == "jellyfin") {
|
||||
jellyfin = {};
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = !config.services.emby.enable;
|
||||
message = "Emby and Jellyfin are incompatible, you cannot enable both";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ minijackson ];
|
||||
}
|
16
nixos/tests/jellyfin.nix
Normal file
16
nixos/tests/jellyfin.nix
Normal file
@ -0,0 +1,16 @@
|
||||
import ./make-test.nix ({ lib, ...}:
|
||||
|
||||
{
|
||||
name = "jellyfin";
|
||||
meta.maintainers = with lib.maintainers; [ minijackson ];
|
||||
|
||||
machine =
|
||||
{ ... }:
|
||||
{ services.jellyfin.enable = true; };
|
||||
|
||||
testScript = ''
|
||||
$machine->waitForUnit('jellyfin.service');
|
||||
$machine->waitForOpenPort('8096');
|
||||
$machine->succeed("curl --fail http://localhost:8096/");
|
||||
'';
|
||||
})
|
@ -37,6 +37,6 @@ stdenv.mkDerivation rec {
|
||||
description = "The Free Software Media System";
|
||||
homepage = https://jellyfin.github.io/;
|
||||
license = licenses.gpl2;
|
||||
maintainers = with maintainers; [ nyanloutre ];
|
||||
maintainers = with maintainers; [ nyanloutre minijackson ];
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user