jellyfin: setup service

This commit is contained in:
Antoine Martin 2021-02-19 21:21:35 +01:00
parent 271fc656cc
commit 2b5ef6b145
4 changed files with 48 additions and 0 deletions

View file

@ -85,6 +85,10 @@ in
privatePort = 8082; privatePort = 8082;
}; };
jellyfin = {
enable = true;
};
miniflux = { miniflux = {
enable = true; enable = true;
adminCredentialsFile = "${../../secrets/miniflux-admin-credentials.secret}"; adminCredentialsFile = "${../../secrets/miniflux-admin-credentials.secret}";

View file

@ -5,7 +5,9 @@
./bitwarden_rs.nix ./bitwarden_rs.nix
./borg-backup.nix ./borg-backup.nix
./gitea.nix ./gitea.nix
./jellyfin.nix
./matrix.nix ./matrix.nix
./media.nix
./miniflux.nix ./miniflux.nix
./monitoring.nix ./monitoring.nix
./nginx.nix ./nginx.nix

32
services/jellyfin.nix Normal file
View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.services.jellyfin;
my = config.my;
domain = config.networking.domain;
# hardcoded in NixOS module :(
jellyfinPort = 8096;
in {
options.my.services.jellyfin = {
enable = mkEnableOption "Jellyfin";
};
config = lib.mkIf cfg.enable {
services.jellyfin = {
enable = true;
group = "media";
};
# Proxy to Jellyfin
services.nginx.virtualHosts."jellyfin.${domain}" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://localhost:${toString jellyfinPort}/";
};
};
}

10
services/media.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, ... }:
let
mediaServices = with config.my.services; [
jellyfin
];
needed = builtins.any (service: service.enable) mediaServices;
in
{
config.users.groups.media = lib.mkIf needed { };
}