nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 makeWrapper,
5 matrix-synapse-unwrapped,
6 extras ? [
7 "postgres"
8 "url-preview"
9 ]
10 ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform matrix-synapse-unwrapped.python.pkgs.systemd-python) "systemd",
11 plugins ? [ ],
12}:
13
14let
15 extraPackages = lib.concatMap (extra: matrix-synapse-unwrapped.optional-dependencies.${extra}) (
16 lib.unique extras
17 );
18
19 pythonEnv = matrix-synapse-unwrapped.python.buildEnv.override {
20 extraLibs = extraPackages ++ plugins;
21 };
22
23 searchPath = "${pythonEnv}/${matrix-synapse-unwrapped.python.sitePackages}";
24in
25stdenv.mkDerivation {
26 name = (lib.appendToName "wrapped" matrix-synapse-unwrapped).name;
27
28 nativeBuildInputs = [
29 makeWrapper
30 ];
31
32 buildCommand = ''
33 for bin in ${matrix-synapse-unwrapped}/bin/*; do
34 echo $bin
35 makeWrapper "$bin" "$out/bin/$(basename $bin)" \
36 --set PYTHONPATH ${searchPath}
37 done;
38 '';
39
40 passthru = {
41 unwrapped = matrix-synapse-unwrapped;
42
43 # for backward compatibility
44 inherit (matrix-synapse-unwrapped) plugins tests;
45 };
46
47 # Carry the maintainer, licenses, and various useful information.
48 inherit (matrix-synapse-unwrapped) meta;
49}