python3Packages.maubot: migrate to pyproject (#528120)

This commit is contained in:
Yohann Boniface
2026-06-13 19:05:57 +00:00
committed by GitHub
@@ -10,43 +10,13 @@
}:
let
# save for overriding it
python' = python;
in
let
python = python'.override {
self = python;
packageOverrides = final: prev: {
# SQLAlchemy>=1,<1.4
# SQLAlchemy 2.0's derivation is very different, so don't override, just write it from scratch
# (see https://github.com/NixOS/nixpkgs/blob/65dbed73949e4c0207e75dcc7271b29f9e457670/pkgs/development/python-modules/sqlalchemy/default.nix)
sqlalchemy = final.buildPythonPackage rec {
pname = "SQLAlchemy";
version = "1.3.24";
format = "setuptools";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-67t3fL+TEjWbiXv4G6ANrg9ctp+6KhgmXcwYpvXvdRk=";
};
postInstall = ''
sed -e 's:--max-worker-restart=5::g' -i setup.cfg
'';
# tests are pretty annoying to set up for this version, and these dependency overrides are already long enough
doCheck = false;
};
};
};
maubot = python.pkgs.buildPythonPackage rec {
maubot = python.pkgs.buildPythonPackage (finalAttrs: {
pname = "maubot";
version = "0.6.0";
format = "setuptools";
pyproject = true;
src = fetchPypi {
inherit pname version;
inherit (finalAttrs) pname version;
hash = "sha256-ZXwyctTjKg1ssYE6Ehc1s1DPhWyc08dIQ4MQz6EQXGg=";
};
@@ -58,7 +28,11 @@ let
})
];
propagatedBuildInputs =
build-system = with python.pkgs; [
setuptools
];
dependencies =
with python.pkgs;
[
# requirements.txt
@@ -76,7 +50,6 @@ let
colorama
questionary
jinja2
setuptools
]
# optional-requirements.txt
++ lib.optionals encryptionSupport [
@@ -85,7 +58,7 @@ let
unpaddedbase64
]
++ lib.optionals sqliteSupport [
sqlalchemy
sqlalchemy_1_3
];
# used for plugin tests
@@ -98,6 +71,11 @@ let
rm $out/example-config.yaml
'';
pythonRelaxDeps = [
"bcrypt"
"ruamel.yaml"
];
pythonImportsCheck = [
"maubot"
];
@@ -111,7 +89,7 @@ let
in
{
tests = {
simple = runCommand "${pname}-tests" { } ''
simple = runCommand "${finalAttrs.pname}-tests" { } ''
${maubot}/bin/mbc --help > $out
'';
};
@@ -135,7 +113,7 @@ let
meta = {
description = "Plugin-based Matrix bot system written in Python";
homepage = "https://maubot.xyz/";
changelog = "https://github.com/maubot/maubot/blob/v${version}/CHANGELOG.md";
changelog = "https://github.com/maubot/maubot/blob/v${finalAttrs.version}/CHANGELOG.md";
license = lib.licenses.agpl3Plus;
# Presumably, people running "nix run nixpkgs#maubot" will want to run the tool
# for interacting with Maubot rather than Maubot itself, which should be used as
@@ -143,7 +121,7 @@ let
mainProgram = "mbc";
maintainers = with lib.maintainers; [ chayleaf ];
};
};
});
in
maubot