services: add pirate
The whole suite of *-arr media managers.
This commit is contained in:
parent
9446651944
commit
680d82bc3b
|
@ -78,6 +78,8 @@
|
|||
jellyfin.enable = true;
|
||||
# Matrix backend and Element chat front-end
|
||||
matrix.enable = true;
|
||||
# The whole *arr software suite
|
||||
pirate.enable = true;
|
||||
};
|
||||
|
||||
programs.gnupg.agent = {
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
./matrix.nix
|
||||
./media.nix
|
||||
./nginx.nix
|
||||
./pirate.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
needed = with config.my.services;
|
||||
jellyfin.enable;
|
||||
jellyfin.enable || pirate.enable;
|
||||
in
|
||||
{
|
||||
config.users.groups.media = lib.mkIf needed { };
|
||||
|
|
42
services/pirate.nix
Normal file
42
services/pirate.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
# The total autonomous media delivery system.
|
||||
# Relevant link [1].
|
||||
#
|
||||
# [1]: https://youtu.be/I26Ql-uX6AM
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.services.pirate;
|
||||
domain = config.networking.domain;
|
||||
|
||||
ports = {
|
||||
sonarr = 8989;
|
||||
radarr = 7878;
|
||||
bazarr = 6767;
|
||||
};
|
||||
|
||||
managers = with lib.attrsets;
|
||||
(mapAttrs
|
||||
(_: _: {
|
||||
enable = true;
|
||||
group = "media";
|
||||
})
|
||||
ports);
|
||||
|
||||
redirections = with lib.attrsets;
|
||||
(mapAttrs'
|
||||
(service: port: nameValuePair "${service}.${domain}" {
|
||||
forceSSL = true;
|
||||
useACMEHost = "${domain}";
|
||||
|
||||
locations."/".proxyPass = "http://localhost:${builtins.toString port}/";
|
||||
})
|
||||
ports);
|
||||
in
|
||||
{
|
||||
options.my.services.pirate = {
|
||||
enable = lib.mkEnableOption "Media automation";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = managers // { nginx.virtualHosts = redirections; };
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue