matrix-synapse: Add wrapper to configure extras

The original matrix-synapse packages is now available with the
-unwrapped prefix.
This commit is contained in:
Martin Weinelt 2023-06-03 02:44:30 +02:00
parent fd429f5bac
commit 3453128510
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
5 changed files with 54 additions and 11 deletions

View file

@ -4,7 +4,7 @@
, fetchPypi
, ldap3
, ldaptor
, matrix-synapse
, matrix-synapse-unwrapped
, pytestCheckHook
, service-identity
, setuptools
@ -33,7 +33,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [ service-identity ldap3 twisted ];
nativeCheckInputs = [ ldaptor matrix-synapse pytestCheckHook ];
nativeCheckInputs = [ ldaptor matrix-synapse-unwrapped pytestCheckHook ];
pythonImportsCheck = [ "ldap_auth_provider" ];

View file

@ -1,4 +1,4 @@
{ lib, stdenv, buildPythonPackage, fetchFromGitHub, matrix-synapse }:
{ lib, stdenv, buildPythonPackage, fetchFromGitHub, matrix-synapse-unwrapped }:
buildPythonPackage rec {
pname = "matrix-synapse-mjolnir-antispam";
@ -13,7 +13,7 @@ buildPythonPackage rec {
sourceRoot = "./source/synapse_antispam";
buildInputs = [ matrix-synapse ];
buildInputs = [ matrix-synapse-unwrapped ];
doCheck = false; # no tests
pythonImportsCheck = [ "mjolnir" ];

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchFromGitHub, matrix-synapse, twisted }:
{ lib, buildPythonPackage, fetchFromGitHub, matrix-synapse-unwrapped, twisted }:
buildPythonPackage rec {
pname = "matrix-synapse-shared-secret-auth";
@ -14,7 +14,7 @@ buildPythonPackage rec {
doCheck = false;
pythonImportsCheck = [ "shared_secret_authenticator" ];
buildInputs = [ matrix-synapse ];
buildInputs = [ matrix-synapse-unwrapped ];
propagatedBuildInputs = [ twisted ];
meta = with lib; {

View file

@ -0,0 +1,44 @@
{ lib
, stdenv
, makeWrapper
, matrix-synapse-unwrapped
, extras ? [
"postgres"
"url-preview"
"user-search"
] ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform matrix-synapse-unwrapped.python.pkgs.systemd) "systemd"
, plugins ? [ ]
, ...
}:
let
extraPackages = lib.concatMap (extra: matrix-synapse-unwrapped.optional-dependencies.${extra}) extras;
pluginsEnv = matrix-synapse-unwrapped.python.buildEnv.override {
extraLibs = plugins;
};
searchPath = lib.makeSearchPathOutput "lib" matrix-synapse-unwrapped.python.sitePackages (extraPackages ++ [ pluginsEnv ]);
in
stdenv.mkDerivation {
name = (lib.appendToName "wrapped" matrix-synapse-unwrapped).name;
nativeBuildInputs = [
makeWrapper
];
buildCommand = ''
for bin in ${matrix-synapse-unwrapped}/bin/*; do
echo $bin
makeWrapper "$bin" "$out/bin/$(basename $bin)" \
--set PYTHONPATH=${searchPath}
done;
'';
passthru = {
unwrapped = matrix-synapse-unwrapped;
# for backward compatibility
inherit (matrix-synapse-unwrapped) plugins tools;
};
}

View file

@ -9624,11 +9624,10 @@ with pkgs;
matrix-sliding-sync = callPackage ../servers/matrix-synapse/sliding-sync { };
matrix-synapse = callPackage ../servers/matrix-synapse { };
matrix-synapse-plugins = recurseIntoAttrs matrix-synapse.plugins;
matrix-synapse-tools = recurseIntoAttrs matrix-synapse.tools;
matrix-synapse = callPackage ../servers/matrix-synapse/wrapper.nix { };
matrix-synapse-unwrapped = callPackage ../servers/matrix-synapse/default.nix { };
matrix-synapse-plugins = recurseIntoAttrs matrix-synapse-unwrapped.plugins;
matrix-synapse-tools = recurseIntoAttrs matrix-synapse-unwrapped.tools;
matrix-appservice-irc = callPackage ../servers/matrix-synapse/matrix-appservice-irc { };