Bruno BELANYI
ed456c999d
All checks were successful
continuous-integration/drone/push Build is passing
It was not the idiomatic way to do this.
39 lines
764 B
Nix
39 lines
764 B
Nix
# 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;
|
|
lidarr = 8686;
|
|
};
|
|
|
|
managers = with lib.attrsets;
|
|
(mapAttrs
|
|
(_: _: {
|
|
enable = true;
|
|
group = "media";
|
|
})
|
|
ports);
|
|
|
|
redirections = lib.flip lib.mapAttrsToList ports
|
|
(subdomain: port: { inherit subdomain port; });
|
|
in
|
|
{
|
|
options.my.services.pirate = {
|
|
enable = lib.mkEnableOption "Media automation";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services = managers;
|
|
my.services.nginx.virtualHosts = redirections;
|
|
# Set-up media group
|
|
users.groups.media = { };
|
|
};
|
|
}
|