anytype: fix build that may not be deterministic

nativeMessagingHost may embed build-specific Go metadata, and keytar node-gyp artifacts may retain build paths. Normalize the Go build and drop those intermediate artifacts before install.
This commit is contained in:
hellodword
2026-07-08 12:12:50 +00:00
parent d407951447
commit d655e286eb
+8 -1
View File
@@ -143,6 +143,11 @@ stdenvNoCC.mkDerivation (finalAttrs: {
substituteInPlace scripts/generate-protos.sh \
--replace-fail "/usr/bin/env" "${coreutils}/bin/env"
substituteInPlace package.json \
--replace-fail \
'"build:nmh": "go build -o dist/nativeMessagingHost ./go/nativeMessagingHost.go"' \
'"build:nmh": "go build -trimpath -ldflags=-buildid= -o dist/nativeMessagingHost ./go/nativeMessagingHost.go"'
cp -r ${anytype-heart}/lib dist/
cp -r ${anytype-heart}/bin/anytypeHelper dist/
@@ -168,7 +173,9 @@ stdenvNoCC.mkDerivation (finalAttrs: {
# remove unnecessary files
preInstall = ''
chmod u+w -R dist node_modules
find -type f \( -name "*.ts" -o -name "*.map" \) -exec rm -rf {} +
find dist node_modules -type f \( -name '*.ts' -o -name '*.map' \) -delete
rm -f node_modules/keytar/build/{Makefile,binding.Makefile,config.gypi,keytar.target.mk}
rm -rf node_modules/keytar/build/Release/{.deps,obj.target}
'';
installPhase = ''