nix-config/modules/nixos/services/podgrab/default.nix

61 lines
1.4 KiB
Nix
Raw Normal View History

# A simple podcast fetcher
2021-09-24 01:15:40 +02:00
{ config, lib, ... }:
2021-04-02 11:07:58 +02:00
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.
'';
};
dataDir = mkOption {
type = with types; nullOr str;
default = null;
example = "/mnt/podgrab";
description = ''
Path to the directory to store the podcasts. Use default if null
'';
};
2021-04-02 11:07:58 +02:00
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;
group = "media";
dataDirectory = lib.mkIf (cfg.dataDir != null) cfg.dataDir;
2021-04-02 11:07:58 +02:00
};
# Set-up media group
users.groups.media = { };
my.services.nginx.virtualHosts = {
podgrab = {
inherit (cfg) port;
};
};
2021-11-05 15:20:11 +01:00
my.system.persist.directories = [
config.systemd.services.podgrab.environment.CONFIG
config.systemd.services.podgrab.environment.DATA
];
2021-04-02 11:07:58 +02:00
};
}