Merge pull request #311916 from wegank/pretalx-plugins-init

pretalx: add a few plugins
This commit is contained in:
Martin Weinelt 2024-05-15 21:41:03 +02:00 committed by GitHub
commit 10955966a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 258 additions and 9 deletions

View File

@ -11,14 +11,19 @@ let
configFile = format.generate "pretalx.cfg" cfg.settings;
extras = cfg.package.optional-dependencies.redis
++ lib.optionals (cfg.settings.database.backend == "mysql") cfg.package.optional-dependencies.mysql
++ lib.optionals (cfg.settings.database.backend == "postgresql") cfg.package.optional-dependencies.postgres;
finalPackage = cfg.package.override {
inherit (cfg) plugins;
};
pythonEnv = cfg.package.python.buildEnv.override {
extraLibs = [ (cfg.package.python.pkgs.toPythonModule cfg.package) ]
++ (with cfg.package.python.pkgs; [ gunicorn ]
++ lib.optional cfg.celery.enable celery) ++ extras;
pythonEnv = finalPackage.python.buildEnv.override {
extraLibs = with finalPackage.python.pkgs; [
(toPythonModule finalPackage)
gunicorn
]
++ finalPackage.optional-dependencies.redis
++ lib.optionals cfg.celery.enable [ celery ]
++ lib.optionals (cfg.settings.database.backend == "mysql") finalPackage.optional-dependencies.mysql
++ lib.optionals (cfg.settings.database.backend == "postgresql") finalPackage.optional-dependencies.postgres;
};
in
@ -44,6 +49,20 @@ in
description = "User under which pretalx should run.";
};
plugins = lib.mkOption {
type = with lib.types; listOf package;
default = [];
example = lib.literalExpression ''
with config.services.pretalx.package.plugins; [
pages
youtube
];
'';
description = ''
Pretalx plugins to install into the Python environment.
'';
};
gunicorn.extraArgs = lib.mkOption {
type = with lib.types; listOf str;
default = [

View File

@ -5,13 +5,16 @@
meta.maintainers = lib.teams.c3d2.members;
nodes = {
pretalx = {
pretalx = { config, ... }: {
networking.extraHosts = ''
127.0.0.1 talks.local
'';
services.pretalx = {
enable = true;
plugins = with config.services.pretalx.package.plugins; [
pages
];
nginx.domain = "talks.local";
settings = {
site.url = "http://talks.local";

View File

@ -3,6 +3,7 @@
, gettext
, python3
, fetchFromGitHub
, plugins ? [ ]
, nixosTests
}:
@ -132,7 +133,7 @@ python.pkgs.buildPythonApplication rec {
vobject
whitenoise
zxcvbn
] ++ beautifulsoup4.optional-dependencies.lxml;
] ++ beautifulsoup4.optional-dependencies.lxml ++ plugins;
passthru.optional-dependencies = {
mysql = with python.pkgs; [
@ -210,6 +211,12 @@ python.pkgs.buildPythonApplication rec {
tests = {
inherit (nixosTests) pretalx;
};
plugins = lib.recurseIntoAttrs (
lib.packagesFromDirectoryRecursive {
inherit (python.pkgs) callPackage;
directory = ./plugins;
}
);
};
inherit meta;

View File

@ -0,0 +1,30 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
}:
buildPythonPackage rec {
pname = "pretalx-downstream";
version = "1.2.0";
pyproject = true;
src = fetchFromGitHub {
owner = "pretalx";
repo = "pretalx-downstream";
rev = "v${version}";
hash = "sha256-MzoK/tzf6ajZ/THIXyad/tfb3lsQD9k9J6aBfoP9ONo=";
};
build-system = [ setuptools ];
pythonImportsCheck = [ "pretalx_downstream" ];
meta = {
description = "Use pretalx passively by importing another event's schedule";
homepage = "https://github.com/pretalx/pretalx-downstream";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ wegank ];
};
}

View File

@ -0,0 +1,30 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
}:
buildPythonPackage rec {
pname = "pretalx-media-ccc-de";
version = "1.2.1";
pyproject = true;
src = fetchFromGitHub {
owner = "pretalx";
repo = "pretalx-media-ccc-de";
rev = "v${version}";
hash = "sha256-QCnZZpYjHxj92Dl2nRd4lXapufcqRmlVH6LEq0rzQ2U=";
};
build-system = [ setuptools ];
pythonImportsCheck = [ "pretalx_media_ccc_de" ];
meta = {
description = "Pull recordings from media.ccc.de and embed them in talk pages";
homepage = "https://github.com/pretalx/pretalx-media-ccc-de";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ wegank ];
};
}

View File

@ -0,0 +1,30 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
}:
buildPythonPackage rec {
pname = "pretalx-pages";
version = "1.4.0";
pyproject = true;
src = fetchFromGitHub {
owner = "pretalx";
repo = "pretalx-pages";
rev = "v${version}";
hash = "sha256-Wzd3uf+mdoyeMCZ4ZYcPLGqlUWCqSL02eeKRubTiH00=";
};
build-system = [ setuptools ];
pythonImportsCheck = [ "pretalx_pages" ];
meta = {
description = "Static pages for pretalx, e.g. information, venue listings, a Code of Conduct, etc";
homepage = "https://github.com/pretalx/pretalx-pages";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ wegank ];
};
}

View File

@ -0,0 +1,30 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
}:
buildPythonPackage rec {
pname = "pretalx-public-voting";
version = "1.5.0";
pyproject = true;
src = fetchFromGitHub {
owner = "pretalx";
repo = "pretalx-public-voting";
rev = "v${version}";
hash = "sha256-0dSnUVXtWEuu+m5PyFjjM2WVYE3+cNqZYlMkRQlI+2U=";
};
build-system = [ setuptools ];
pythonImportsCheck = [ "pretalx_public_voting" ];
meta = {
description = "A public voting plugin for pretalx";
homepage = "https://github.com/pretalx/pretalx-public-voting";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ wegank ];
};
}

View File

@ -0,0 +1,40 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
gettext,
setuptools,
django,
pyjwt,
}:
buildPythonPackage rec {
pname = "pretalx-venueless";
version = "1.3.0";
pyproject = true;
src = fetchFromGitHub {
owner = "pretalx";
repo = "pretalx-venueless";
rev = "v${version}";
hash = "sha256-h8o5q1roFm8Bct/Qf8obIJYkkGPcz3WJ15quxZH48H8=";
};
nativeBuildInputs = [ gettext ];
build-system = [ setuptools ];
dependencies = [
django
pyjwt
];
pythonImportsCheck = [ "pretalx_venueless" ];
meta = {
description = "Static venueless for pretalx, e.g. information, venue listings, a Code of Conduct, etc";
homepage = "https://github.com/pretalx/pretalx-venueless";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ wegank ];
};
}

View File

@ -0,0 +1,30 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
}:
buildPythonPackage rec {
pname = "pretalx-vimeo";
version = "2.2.0";
pyproject = true;
src = fetchFromGitHub {
owner = "pretalx";
repo = "pretalx-vimeo";
rev = "v${version}";
hash = "sha256-CVP9C2wY51p8UDnzPpjzdVv5b9CSVanGbkaJiOo+9eY=";
};
build-system = [ setuptools ];
pythonImportsCheck = [ "pretalx_vimeo" ];
meta = {
description = "Static vimeo for pretalx, e.g. information, venue listings, a Code of Conduct, etc";
homepage = "https://github.com/pretalx/pretalx-vimeo";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ wegank ];
};
}

View File

@ -0,0 +1,30 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
}:
buildPythonPackage rec {
pname = "pretalx-youtube";
version = "2.1.0";
pyproject = true;
src = fetchFromGitHub {
owner = "pretalx";
repo = "pretalx-youtube";
rev = "v${version}";
hash = "sha256-j3NZ+5QBbdpE2bxenqq5bW/42CWvQ9FqrKMmfYIe4Lo=";
};
build-system = [ setuptools ];
pythonImportsCheck = [ "pretalx_youtube" ];
meta = {
description = "Static youtube for pretalx, e.g. information, venue listings, a Code of Conduct, etc";
homepage = "https://github.com/pretalx/pretalx-youtube";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ wegank ];
};
}