Refactored mediaserver

This commit is contained in:
Julien Malka 2022-02-05 19:00:46 +01:00
parent 3a5e96b530
commit 051426d64b
No known key found for this signature in database
GPG key ID: 3C68E13964FEA07F
2 changed files with 81 additions and 63 deletions

View file

@ -15,7 +15,11 @@
luj = {
mediaserver.enable = true;
mediaserver = {
enable = true;
tv.enable = true;
music.enable = true;
};
homepage.enable = true;
bincache = {
enable = true;

View file

@ -1,13 +1,17 @@
{ lib, pkgs, config, ... }:
with lib;
let cfg = config.luj.mediaserver;
in {
in
{
options.luj.mediaserver = {
enable = mkEnableOption "enable the mediaserver";
tv.enable = mkEnableOption "enable the tv mediaserver";
music.enable = mkEnableOption "enable the music mediaserver";
};
config = mkIf cfg.enable {
config = mkIf cfg.enable (
mkMerge [{
users.users.mediaserver = {
name = "mediaserver";
@ -20,6 +24,28 @@ in {
name = "mediaserver";
};
luj.jackett = {
enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true;
nginx.subdomain = "jackett";
};
luj.flaresolverr.enable = true;
luj.transmission = {
enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true;
nginx.subdomain = "downloads";
};
}
(mkIf cfg.tv.enable {
luj.sonarr = {
enable = true;
@ -36,15 +62,6 @@ in {
nginx.enable = true;
nginx.subdomain = "films";
};
luj.lidarr = {
enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true;
nginx.subdomain = "songs";
};
luj.jellyfin = {
enable = true;
user = "mediaserver";
@ -53,16 +70,18 @@ in {
nginx.subdomain = "tv";
};
luj.jackett = {
})
(mkIf cfg.music.enable {
luj.lidarr = {
enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true;
nginx.subdomain = "jackett";
nginx.subdomain = "songs";
};
luj.flaresolverr.enable = true;
luj.navidrome = {
enable = true;
user = "mediaserver";
@ -71,13 +90,8 @@ in {
nginx.subdomain = "music";
};
luj.transmission = {
enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true;
nginx.subdomain = "downloads";
};
};
})]);
}