logos-chat/nix/bundle.nix

35 lines
1017 B
Nix
Raw Normal View History

2026-02-27 18:41:34 +01:00
{ lib, stdenv, rust-bin, makeRustPlatform, perl, pkg-config, cmake, src }:
let
rustToolchain = rust-bin.fromRustupToolchainFile (src + "/vendor/libchat/rust_toolchain.toml");
rPlatform = makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
in rPlatform.buildRustPackage {
pname = "rust-bundle";
version = "0.1.0";
inherit src;
cargoRoot = "rust-bundle";
cargoLock = {
lockFile = src + "/rust-bundle/Cargo.lock";
# Add outputHashes here for any git/non-registry deps that appear in
# rust-bundle/Cargo.lock (run `nix build` once; it will report missing hashes).
outputHashes = {};
};
nativeBuildInputs = [ perl pkg-config cmake ];
doCheck = false;
buildAndTestSubdir = "rust-bundle";
installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp rust-bundle/target/*/release/lib_rust_bundle.a $out/lib/ 2>/dev/null || true
cp rust-bundle/target/release/lib_rust_bundle.a $out/lib/ 2>/dev/null || true
runHook postInstall
'';
}