From e64b418e3e01d586296eebd4a680001a99d72a75 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 14 Apr 2021 17:03:24 +0000 Subject: [PATCH 1/4] maintainers: add ambroisie --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index c64c1ecde82..d3eab5c01ad 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -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"; From ccb1b4710d07fc851dd11da8746b341ed00cfbaa Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 14 Apr 2021 17:05:40 +0000 Subject: [PATCH 2/4] podgrab: init at 2021-04-14 Closes #117284. --- pkgs/servers/misc/podgrab/default.nix | 28 +++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/servers/misc/podgrab/default.nix diff --git a/pkgs/servers/misc/podgrab/default.nix b/pkgs/servers/misc/podgrab/default.nix new file mode 100644 index 00000000000..6703fbc53ed --- /dev/null +++ b/pkgs/servers/misc/podgrab/default.nix @@ -0,0 +1,28 @@ +{ lib, fetchFromGitHub, buildGoModule }: + +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/ + ''; + + 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4d009d82b15..f33aac22b54 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; From f1b36d19fda8678c796f0627e2bd2723171ea0f4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 14 Apr 2021 17:06:37 +0000 Subject: [PATCH 3/4] 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 5271cbebc26..d0ef7a42eaf 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 00000000000..7077408b794 --- /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 ]; +} From 1144486f3a330c1e3a005022246db4eac194225d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 14 Apr 2021 17:15:41 +0000 Subject: [PATCH 4/4] nixos/tests/podgrab: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/podgrab.nix | 34 +++++++++++++++++++++++++++ pkgs/servers/misc/podgrab/default.nix | 4 +++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/podgrab.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 47384cf5a8a..1a6df8a181c 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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 {}; diff --git a/nixos/tests/podgrab.nix b/nixos/tests/podgrab.nix new file mode 100644 index 00000000000..e927e25fea5 --- /dev/null +++ b/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 ]; +}) diff --git a/pkgs/servers/misc/podgrab/default.nix b/pkgs/servers/misc/podgrab/default.nix index 6703fbc53ed..a5fd230d48f 100644 --- a/pkgs/servers/misc/podgrab/default.nix +++ b/pkgs/servers/misc/podgrab/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, buildGoModule }: +{ lib, fetchFromGitHub, buildGoModule, nixosTests }: buildGoModule rec { pname = "podgrab"; @@ -19,6 +19,8 @@ buildGoModule rec { 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";