Bruno BELANYI
77cf3430ae
And when not possible, document why. Note for the future: there is some repetition in some modules to configure the correct value of the subdomain, which I happen to know will line up correctly thanks to the nginx wrapper. A good way to refactor this in the future would involve avoiding this repetition, allowing use to query the correct domain in some way...
42 lines
959 B
Nix
42 lines
959 B
Nix
# A simple podcast fetcher
|
|
{ config, lib, pkgs, ... }:
|
|
let
|
|
cfg = config.my.services.podgrab;
|
|
in
|
|
{
|
|
options.my.services.podgrab = with lib; {
|
|
enable = mkEnableOption "Podgrab, a self-hosted podcast manager";
|
|
|
|
passwordFile = mkOption {
|
|
type = with types; nullOr str;
|
|
default = null;
|
|
example = "/run/secrets/password.env";
|
|
description = ''
|
|
The path to a file containing the PASSWORD environment variable
|
|
definition for Podgrab's authentification.
|
|
'';
|
|
};
|
|
|
|
port = mkOption {
|
|
type = types.port;
|
|
default = 8080;
|
|
example = 4242;
|
|
description = "The port on which Podgrab will listen for incoming HTTP traffic.";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.podgrab = {
|
|
enable = true;
|
|
inherit (cfg) passwordFile port;
|
|
};
|
|
|
|
my.services.nginx.virtualHosts = [
|
|
{
|
|
subdomain = "podgrab";
|
|
inherit (cfg) port;
|
|
}
|
|
];
|
|
};
|
|
}
|