Merge pull request #119443 from ambroisie/add-podgrab

Add podgrab package and module
This commit is contained in:
Luke Granger-Brown 2021-04-25 14:12:40 +01:00 committed by GitHub
commit ed83f6455c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 124 additions and 0 deletions

View File

@ -498,6 +498,12 @@
githubId = 15623522;
name = "Amar Paul";
};
ambroisie = {
email = "bruno.nixpkgs@belanyi.fr";
github = "ambroisie";
githubId = 12465195;
name = "Bruno BELANYI";
};
ambrop72 = {
email = "ambrop7@gmail.com";
github = "ambrop72";

View File

@ -530,6 +530,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

View File

@ -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 ];
}

View File

@ -324,6 +324,7 @@ in
pleroma = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./pleroma.nix {};
plikd = handleTest ./plikd.nix {};
plotinus = handleTest ./plotinus.nix {};
podgrab = handleTest ./podgrab.nix {};
podman = handleTestOn ["x86_64-linux"] ./podman.nix {};
pomerium = handleTestOn ["x86_64-linux"] ./pomerium.nix {};
postfix = handleTest ./postfix.nix {};

34
nixos/tests/podgrab.nix Normal file
View File

@ -0,0 +1,34 @@
let
defaultPort = 8080;
customPort = 4242;
in
import ./make-test-python.nix ({ pkgs, ... }: {
name = "podgrab";
nodes = {
default = { ... }: {
services.podgrab.enable = true;
};
customized = { ... }: {
services.podgrab = {
enable = true;
port = customPort;
};
};
};
testScript = ''
start_all()
default.wait_for_unit("podgrab")
default.wait_for_open_port("${toString defaultPort}")
default.succeed("curl --fail http://localhost:${toString defaultPort}")
customized.wait_for_unit("podgrab")
customized.wait_for_open_port("${toString customPort}")
customized.succeed("curl --fail http://localhost:${toString customPort}")
'';
meta.maintainers = with pkgs.lib.maintainers; [ ambroisie ];
})

View File

@ -0,0 +1,30 @@
{ lib, fetchFromGitHub, buildGoModule, nixosTests }:
buildGoModule rec {
pname = "podgrab";
version = "unstable-2021-04-14";
src = fetchFromGitHub {
owner = "akhilrex";
repo = pname;
rev = "3179a875b8b638fb86d0e829d12a9761c1cd7f90";
sha256 = "sha256-vhxIm20ZUi+RusrAsSY54tv/D570/oMO5qLz9dNqgqo=";
};
vendorSha256 = "sha256-xY9xNuJhkWPgtqA/FBVIp7GuWOv+3nrz6l3vaZVLlIE=";
postInstall = ''
mkdir -p $out/share/
cp -r $src/client $out/share/
cp -r $src/webassets $out/share/
'';
passthru.tests = { inherit (nixosTests) podgrab; };
meta = with lib; {
description = "A self-hosted podcast manager to download episodes as soon as they become live";
homepage = "https://github.com/akhilrex/podgrab";
license = licenses.gpl3Only;
maintainers = with maintainers; [ ambroisie ];
};
}

View File

@ -18538,6 +18538,8 @@ in
hyp = callPackage ../servers/http/hyp { };
podgrab = callPackage ../servers/misc/podgrab { };
prosody = callPackage ../servers/xmpp/prosody {
# _compat can probably be removed on next minor version after 0.10.0
lua5 = lua5_2_compat;