Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
83 lines
2.0 KiB
Nix
83 lines
2.0 KiB
Nix
{
|
|
stdenv,
|
|
rustPlatform,
|
|
fetchNpmDeps,
|
|
npmHooks,
|
|
protobuf,
|
|
clang,
|
|
gitMinimal,
|
|
cmake,
|
|
boringssl,
|
|
runCommand,
|
|
fetchFromGitHub,
|
|
python3,
|
|
nodejs,
|
|
}:
|
|
let
|
|
# boring-sys expects the static libraries in build/ instead of lib/
|
|
boringssl-wrapper = runCommand "boringssl-wrapper" { } ''
|
|
mkdir $out
|
|
cd $out
|
|
ln -s ${boringssl.out}/lib build
|
|
ln -s ${boringssl.dev}/include include
|
|
'';
|
|
in
|
|
rustPlatform.buildRustPackage (finalAttrs: {
|
|
pname = "libsignal-node";
|
|
version = "0.81.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "signalapp";
|
|
repo = "libsignal";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-uhxfVFsoB+c1R5MUOgpJFm8ZD3vgU8BIn35QSfbEp5w=";
|
|
};
|
|
|
|
cargoHash = "sha256-Q3GSeaW3YveLxLeJPpPXUVwlJ0QLRkAmRGSJetxKl4Y=";
|
|
|
|
npmRoot = "node";
|
|
npmDeps = fetchNpmDeps {
|
|
name = "${finalAttrs.pname}-npm-deps";
|
|
inherit (finalAttrs) version src;
|
|
sourceRoot = "${finalAttrs.src.name}/${finalAttrs.npmRoot}";
|
|
hash = "sha256-6Mr3SJn4pO0p6PISXvEOhN9uPk1TIEU03ssclNUg2No=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
python3
|
|
protobuf
|
|
nodejs
|
|
clang
|
|
gitMinimal
|
|
cmake
|
|
npmHooks.npmConfigHook
|
|
rustPlatform.bindgenHook
|
|
];
|
|
env.BORING_BSSL_PATH = "${boringssl-wrapper}";
|
|
env.NIX_LDFLAGS = if stdenv.hostPlatform.isDarwin then "-lc++" else "-lstdc++";
|
|
|
|
patches = [
|
|
# This is used to strip absolute paths of dependencies to avoid leaking info about build machine. Nix builders
|
|
# already solve this problem by chrooting os this is not needed.
|
|
./dont-strip-absolute-paths.patch
|
|
];
|
|
postPatch = ''
|
|
substituteInPlace node/build_node_bridge.py \
|
|
--replace-fail "'prebuilds'" "'$out/lib'" \
|
|
--replace-fail "objcopy = shutil.which('%s-linux-gnu-objcopy' % cargo_target.split('-')[0]) or 'objcopy'" \
|
|
"objcopy = os.getenv('OBJCOPY', 'objcopy')"
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
pushd node
|
|
npm run build -- --copy-to-prebuilds --node-arch ${stdenv.hostPlatform.node.arch}
|
|
popd
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
dontCargoInstall = true;
|
|
})
|