diff options
author | Yt <raphael@megzari.com> | 2023-12-27 11:28:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 11:28:42 +0000 |
commit | bd5ff672663004e975ad394fa62645dcd3b48455 (patch) | |
tree | 3658c0b826d5861be5f36274348f3a79be2ca7dc /pkgs/by-name | |
parent | 14f87e678ac870bc5f879230d5c4cc21043ec3c2 (diff) | |
parent | 80d88736dac65208651f6832a8d7ecfdeea844ba (diff) |
Merge pull request #261789 from onny/rspamd-trainer
nixos/rspamd-trainer: init; rspamd-trainer: init at unstable-2023-11-27
Diffstat (limited to 'pkgs/by-name')
-rw-r--r-- | pkgs/by-name/rs/rspamd-trainer/package.nix | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/pkgs/by-name/rs/rspamd-trainer/package.nix b/pkgs/by-name/rs/rspamd-trainer/package.nix new file mode 100644 index 0000000000000..0479b8f07da40 --- /dev/null +++ b/pkgs/by-name/rs/rspamd-trainer/package.nix @@ -0,0 +1,59 @@ +{ lib +, python3 +, python3Packages +, fetchFromGitLab +, makeWrapper +, stdenv +, fetchpatch +, rspamd +}: + +python3Packages.buildPythonApplication { + pname = "rspamd-trainer"; + version = "unstable-2023-11-27"; + format = "pyproject"; + + src = fetchFromGitLab { + owner = "onlime"; + repo = "rspamd-trainer"; + rev = "eb6639a78a019ade6781f3a8418eddc030f8fa14"; + hash = "sha256-Me6WZhQ6SvDGGBQQtSA/7bIfKtsz6D5rvQeU12sVzgY="; + }; + + patches = [ + # Refactor pyproject.toml + # https://gitlab.com/onlime/rspamd-trainer/-/merge_requests/2 + (fetchpatch { + url = "https://gitlab.com/onlime/rspamd-trainer/-/commit/8824bfb9a9826988a90a401b8e51c20f5366ed70.patch"; + hash = "sha256-qiXfwMUfM/iV+fHba8xdwQD92RQz627+HdUTgwgRZdc="; + name = "refactor_pyproject.patch"; + }) + ]; + + postPatch = '' + # Fix module path not applied by patch + mv helper src/ + touch src/helper/__init__.py + mv settings.py src/rspamd_trainer/ + sed -i 's/from settings/from .settings/' src/rspamd_trainer/run.py + + # Fix rspamc path + sed -i "s|/usr/bin/rspamc|${rspamd}/bin/rspamc|" src/rspamd_trainer/run.py + ''; + + nativeBuildInputs = with python3.pkgs; [ + setuptools-scm + ]; + + propagatedBuildInputs = with python3.pkgs; [ + python-dotenv + imapclient + ]; + + meta = { + homepage = "https://gitlab.com/onlime/rspamd-trainer"; + description = "Grabs messages from a spam mailbox via IMAP and feeds them to Rspamd for training"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ onny ]; + }; +} |