Skip to content

Commit

Permalink
matrix-synapse: only include used optional dependencies in check
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyangli committed Jan 1, 2025
1 parent 88195a9 commit d156dbb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions pkgs/servers/matrix-synapse/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,42 @@ let
lib.unique extras
);

pythonEnv = matrix-synapse-unwrapped.python.buildEnv.override {
# Remove all unnecessary nativeCheckInputs
redundantInputs = lib.subtractLists extraPackages (lib.flatten (
lib.attrValues matrix-synapse-unwrapped.optional-dependencies
));
matrix-synapse-unwrapped-stripped = matrix-synapse-unwrapped.overridePythonAttrs (oldAttrs: {
nativeCheckInputs = lib.subtractLists redundantInputs oldAttrs.nativeCheckInputs;
});

pythonEnv = matrix-synapse-unwrapped-stripped.python.buildEnv.override {
extraLibs = extraPackages ++ plugins;
};

searchPath = "${pythonEnv}/${matrix-synapse-unwrapped.python.sitePackages}";
in
stdenv.mkDerivation {
name = (lib.appendToName "wrapped" matrix-synapse-unwrapped).name;
name = (lib.appendToName "wrapped" matrix-synapse-unwrapped-stripped).name;

nativeBuildInputs = [
makeWrapper
];

buildCommand = ''
for bin in ${matrix-synapse-unwrapped}/bin/*; do
for bin in ${matrix-synapse-unwrapped-stripped}/bin/*; do
echo $bin
makeWrapper "$bin" "$out/bin/$(basename $bin)" \
--set PYTHONPATH ${searchPath}
done;
'';

passthru = {
unwrapped = matrix-synapse-unwrapped;
unwrapped = matrix-synapse-unwrapped-stripped;

# for backward compatibility
inherit (matrix-synapse-unwrapped) plugins tests tools;
inherit (matrix-synapse-unwrapped-stripped) plugins tests tools;
};

# Carry the maintainer, licenses, and various useful information.
inherit (matrix-synapse-unwrapped) meta;
inherit (matrix-synapse-unwrapped-stripped) meta;
}

0 comments on commit d156dbb

Please sign in to comment.