2021-01-31 22:32:30 +01:00
|
|
|
# The total autonomous media delivery system.
|
|
|
|
# Relevant link [1].
|
|
|
|
#
|
|
|
|
# [1]: https://youtu.be/I26Ql-uX6AM
|
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.services.pirate;
|
|
|
|
|
|
|
|
ports = {
|
|
|
|
sonarr = 8989;
|
|
|
|
radarr = 7878;
|
|
|
|
bazarr = 6767;
|
2021-02-16 17:38:48 +01:00
|
|
|
lidarr = 8686;
|
2021-01-31 22:32:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
managers = with lib.attrsets;
|
|
|
|
(mapAttrs
|
|
|
|
(_: _: {
|
|
|
|
enable = true;
|
|
|
|
group = "media";
|
|
|
|
})
|
|
|
|
ports);
|
|
|
|
|
2021-08-24 23:05:10 +02:00
|
|
|
redirections = lib.flip lib.mapAttrsToList ports
|
|
|
|
(subdomain: port: { inherit subdomain port; });
|
2021-01-31 22:32:30 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.pirate = {
|
|
|
|
enable = lib.mkEnableOption "Media automation";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
2021-08-24 23:05:10 +02:00
|
|
|
services = managers;
|
|
|
|
my.services.nginx.virtualHosts = redirections;
|
2021-09-15 15:57:23 +02:00
|
|
|
# Set-up media group
|
|
|
|
users.groups.media = { };
|
2021-01-31 22:32:30 +01:00
|
|
|
};
|
|
|
|
}
|