Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add podgrab package and module #119443

Merged
merged 4 commits into from Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Expand Up @@ -492,6 +492,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";
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Expand Up @@ -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
Expand Down
50 changes: 50 additions & 0 deletions 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 = {
ambroisie marked this conversation as resolved.
Show resolved Hide resolved
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 ];
}
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Expand Up @@ -321,6 +321,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 {};
Expand Down
34 changes: 34 additions & 0 deletions nixos/tests/podgrab.nix
@@ -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 ];
})
30 changes: 30 additions & 0 deletions pkgs/servers/misc/podgrab/default.nix
@@ -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/
'';

ambroisie marked this conversation as resolved.
Show resolved Hide resolved
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 ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -18391,6 +18391,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;
Expand Down