1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-01 10:00:56 +00:00
nixpkgs/nixos/modules/services/misc/jellyfin.nix

58 lines
1.3 KiB
Nix
Raw Normal View History

2019-04-14 12:10:50 +01:00
{ 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") {
2019-10-12 21:25:28 +01:00
jellyfin = {
group = cfg.group;
isSystemUser = true;
};
2019-04-14 12:10:50 +01:00
};
users.groups = mkIf (cfg.group == "jellyfin") {
jellyfin = {};
};
};
meta.maintainers = with lib.maintainers; [ minijackson ];
}