mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-06-08 18:09:06 +02:00
Added a (tiny) bit of modularity in the mediaserver module
This commit is contained in:
parent
08df42e079
commit
8e4ddf4ef0
6 changed files with 213 additions and 133 deletions
|
@ -1,41 +1,56 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
let
|
||||
cfg = config.luj.sonarr;
|
||||
port = 8989;
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.luj.sonarr = {
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
options.luj.sonarr = {
|
||||
enable = mkEnableOption "activate sonarr service";
|
||||
nginx.enable = mkEnableOption "activate nginx";
|
||||
nginx.subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge [{
|
||||
services.sonarr = {
|
||||
enable = true;
|
||||
user = "mediaserver";
|
||||
group = "mediaserver";
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
mkMerge [{
|
||||
services.sonarr = {
|
||||
enable = true;
|
||||
user = cfg.user;
|
||||
group = cfg.group;
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
|
||||
})]);
|
||||
|
||||
|
||||
})
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue