Added a (tiny) bit of modularity in the mediaserver module

This commit is contained in:
Julien Malka 2021-12-29 10:40:31 +01:00
parent 08df42e079
commit 8e4ddf4ef0
No known key found for this signature in database
GPG key ID: 3C68E13964FEA07F
6 changed files with 213 additions and 133 deletions

View file

@ -3,22 +3,37 @@ with lib;
let let
cfg = config.luj.jackett; cfg = config.luj.jackett;
port = 9117; port = 9117;
in { in
{
options.luj.jackett = { options.luj.jackett = {
enable = mkEnableOption "activate jackett service"; enable = mkEnableOption "activate jackett service";
user = mkOption {
type = types.str;
default = "jackett";
description = "User account under which Jackett runs.";
};
group = mkOption {
type = types.str;
default = "jackett";
description = "Group under which Jackett runs.";
};
nginx.enable = mkEnableOption "activate nginx"; nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption { nginx.subdomain = mkOption {
type = types.str; type = types.str;
}; };
}; };
config = mkIf cfg.enable ( config = mkIf cfg.enable (
mkMerge [{ mkMerge [{
services.jackett = { services.jackett = {
enable = true; enable = true;
user = "mediaserver"; user = cfg.user;
group = "mediaserver"; group = cfg.group;
}; };
} }
@ -32,8 +47,7 @@ in {
}; };
}; };
}) })]);
]);

View file

@ -3,10 +3,25 @@ with lib;
let let
cfg = config.luj.jellyfin; cfg = config.luj.jellyfin;
port = 8096; port = 8096;
in { in
{
options.luj.jellyfin = { options.luj.jellyfin = {
enable = mkEnableOption "activate jellyfin service"; enable = mkEnableOption "activate jellyfin service";
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.";
};
nginx.enable = mkEnableOption "activate nginx"; nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption { nginx.subdomain = mkOption {
type = types.str; type = types.str;
@ -17,9 +32,8 @@ in {
mkMerge [{ mkMerge [{
services.jellyfin = { services.jellyfin = {
enable = true; enable = true;
user = "mediaserver"; user = cfg.user;
group = "mediaserver"; group = cfg.group;
package = pkgs.jellyfin;
}; };
} }
@ -33,8 +47,7 @@ in {
}; };
}; };
}) })]);
]);

View file

@ -23,30 +23,40 @@ in {
luj.sonarr = { luj.sonarr = {
enable = true; enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true; nginx.enable = true;
nginx.subdomain = "series"; nginx.subdomain = "series";
}; };
luj.radarr = { luj.radarr = {
enable = true; enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true; nginx.enable = true;
nginx.subdomain = "films"; nginx.subdomain = "films";
}; };
luj.jellyfin = { luj.jellyfin = {
enable = true; enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true; nginx.enable = true;
nginx.subdomain = "tv"; nginx.subdomain = "tv";
}; };
luj.jackett = { luj.jackett = {
enable = true; enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true; nginx.enable = true;
nginx.subdomain = "jackett"; nginx.subdomain = "jackett";
}; };
luj.transmission = { luj.transmission = {
enable = true; enable = true;
user = "mediaserver";
group = "mediaserver";
nginx.enable = true; nginx.enable = true;
nginx.subdomain = "downloads"; nginx.subdomain = "downloads";
}; };

View file

@ -3,22 +3,38 @@ with lib;
let let
cfg = config.luj.radarr; cfg = config.luj.radarr;
port = 7878; port = 7878;
in { in
{
options.luj.radarr = { options.luj.radarr = {
enable = mkEnableOption "activate radarr service"; enable = mkEnableOption "activate radarr service";
user = mkOption {
type = types.str;
default = "radarr";
description = "User account under which Radarr runs.";
};
group = mkOption {
type = types.str;
default = "radarr";
description = "Group under which Radarr runs.";
};
nginx.enable = mkEnableOption "activate nginx"; nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption { nginx.subdomain = mkOption {
type = types.str; type = types.str;
}; };
}; };
config = mkIf cfg.enable ( config = mkIf cfg.enable (
mkMerge [{ mkMerge [{
services.radarr = { services.radarr = {
enable = true; enable = true;
user = "mediaserver"; user = cfg.user;
group = "mediaserver"; group = cfg.group;
}; };
} }
@ -32,8 +48,7 @@ in {
}; };
}; };
}) })]);
]);

View file

@ -3,22 +3,38 @@ with lib;
let let
cfg = config.luj.sonarr; cfg = config.luj.sonarr;
port = 8989; port = 8989;
in { in
{
options.luj.sonarr = { options.luj.sonarr = {
enable = mkEnableOption "activate sonarr service"; enable = mkEnableOption "activate sonarr service";
user = mkOption {
type = types.str;
default = "sonarr";
description = "User account under which Sonarr runs.";
};
group = mkOption {
type = types.str;
default = "sonarr";
description = "Group under which Sonarr runs.";
};
nginx.enable = mkEnableOption "activate nginx"; nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption { nginx.subdomain = mkOption {
type = types.str; type = types.str;
}; };
}; };
config = mkIf cfg.enable ( config = mkIf cfg.enable (
mkMerge [{ mkMerge [{
services.sonarr = { services.sonarr = {
enable = true; enable = true;
user = "mediaserver"; user = cfg.user;
group = "mediaserver"; group = cfg.group;
}; };
} }
@ -32,8 +48,7 @@ in {
}; };
}; };
}) })]);
]);

View file

@ -3,30 +3,44 @@ with lib;
let let
cfg = config.luj.transmission; cfg = config.luj.transmission;
port = 9091; port = 9091;
in { in
{
options.luj.transmission = { options.luj.transmission = {
enable = mkEnableOption "activate transmission service"; enable = mkEnableOption "activate transmission service";
user = mkOption {
type = types.str;
default = "transmission";
description = "User account under which transmission runs.";
};
group = mkOption {
type = types.str;
default = "transmission";
description = "Group under which Transmission runs.";
};
nginx.enable = mkEnableOption "activate nginx"; nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption { nginx.subdomain = mkOption {
type = types.str; type = types.str;
}; };
}; };
config = mkIf cfg.enable ( config = mkIf cfg.enable (
mkMerge [{ mkMerge [{
sops.secrets.transmission = { sops.secrets.transmission = {
owner = "mediaserver"; owner = cfg.user;
format = "binary"; format = "binary";
sopsFile = ../../secrets/transmission-login; sopsFile = ../../secrets/transmission-login;
}; };
services.transmission = { services.transmission = {
enable = true; enable = true;
user = "mediaserver"; user = cfg.user;
group = "mediaserver"; group = cfg.group;
credentialsFile = "/run/secrets/transmission"; credentialsFile = "/run/secrets/transmission";
downloadDirPermissions = "770"; downloadDirPermissions = "770";
settings = { settings = {
@ -48,8 +62,7 @@ in {
}; };
}; };
}) })]);
]);