mempool: minor refactorings

- Use `sourceRoot`
- Allow `generate.sh` to directly trigger the build of `nodeModules`.
  Needed by mempool 3.2.1, where `mempool-backend` has multiple fixed output
  derivation dependencies, which can only be updated if they can be
  built directly.
This commit is contained in:
Erik Arvstedt 2025-06-02 10:46:52 +02:00
parent c48b99782d
commit d61099a535
No known key found for this signature in database
GPG key ID: 33312B944DD97846
2 changed files with 8 additions and 4 deletions

View file

@ -26,12 +26,12 @@ rec {
nodeModules = { nodeModules = {
frontend = fetchNodeModules { frontend = fetchNodeModules {
inherit src nodejs; inherit src nodejs;
preBuild = "cd frontend"; sourceRoot = "source/frontend";
hash = "sha256-/Z0xNvob7eMGpzdUWolr47vljpFiIutZpGwd0uYhPWI="; hash = "sha256-/Z0xNvob7eMGpzdUWolr47vljpFiIutZpGwd0uYhPWI=";
}; };
backend = fetchNodeModules { backend = fetchNodeModules {
inherit src nodejs; inherit src nodejs;
preBuild = "cd backend"; sourceRoot = "source/backend";
hash = "sha256-HpzzSTuSRWDWGbctVhTcUA01if/7OTI4xN3DAbAAX+U="; hash = "sha256-HpzzSTuSRWDWGbctVhTcUA01if/7OTI4xN3DAbAAX+U=";
}; };
}; };
@ -67,6 +67,7 @@ rec {
passthru = { passthru = {
inherit nodejs nodejsRuntime; inherit nodejs nodejsRuntime;
nodeModules = nodeModules.backend;
}; };
}; };
@ -99,7 +100,10 @@ rec {
runHook postInstall runHook postInstall
''; '';
passthru = { assets = frontendAssets; }; passthru = {
assets = frontendAssets;
nodeModules = nodeModules.frontend;
};
}; };
mempool-nginx-conf = runCommand "mempool-nginx-conf" {} '' mempool-nginx-conf = runCommand "mempool-nginx-conf" {} ''

View file

@ -50,7 +50,7 @@ updateNodeModulesHash() {
component=$1 component=$1
echo echo
echo "Fetching node modules for mempool-$component" echo "Fetching node modules for mempool-$component"
../../helper/update-fixed-output-derivation.sh ./default.nix mempool-"$component" "cd $component" ../../helper/update-fixed-output-derivation.sh ./default.nix mempool-"$component".nodeModules "sourceRoot.*$component"
} }
updateFrontendAssets() { updateFrontendAssets() {