diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index a746b7b3e5d..36140b3889b 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -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"; diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 811eae020d5..3720b24f395 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 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 ]; +} diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 1ca1c3854f8..3aefa82301c 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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 {}; 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 new file mode 100644 index 00000000000..a5fd230d48f --- /dev/null +++ b/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/ + ''; + + 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 93081bc0dde..1d168499a14 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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;