From f1b36d19fda8678c796f0627e2bd2723171ea0f4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 14 Apr 2021 17:06:37 +0000 Subject: [PATCH] nixos/podgrab: add module Closes #117284. --- nixos/modules/module-list.nix | 1 + nixos/modules/services/misc/podgrab.nix | 50 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 nixos/modules/services/misc/podgrab.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 5271cbebc261..d0ef7a42eaf5 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -526,6 +526,7 @@ ./services/misc/parsoid.nix ./services/misc/plex.nix ./services/misc/plikd.nix + ./services/misc/podgrab.nix ./services/misc/tautulli.nix ./services/misc/pinnwand.nix ./services/misc/pykms.nix diff --git a/nixos/modules/services/misc/podgrab.nix b/nixos/modules/services/misc/podgrab.nix new file mode 100644 index 000000000000..7077408b7942 --- /dev/null +++ b/nixos/modules/services/misc/podgrab.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.services.podgrab; +in +{ + options.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 { + systemd.services.podgrab = { + description = "Podgrab podcast manager"; + wantedBy = [ "multi-user.target" ]; + environment = { + CONFIG = "/var/lib/podgrab/config"; + DATA = "/var/lib/podgrab/data"; + GIN_MODE = "release"; + PORT = toString cfg.port; + }; + serviceConfig = { + DynamicUser = true; + EnvironmentFile = lib.optional (cfg.passwordFile != null) [ + cfg.passwordFile + ]; + ExecStart = "${pkgs.podgrab}/bin/podgrab"; + WorkingDirectory = "${pkgs.podgrab}/share"; + StateDirectory = [ "podgrab/config" "podgrab/data" ]; + }; + }; + }; + + meta.maintainers = with lib.maintainers; [ ambroisie ]; +}