logos-chat/nix/libchat.nix

37 lines
1.1 KiB
Nix
Raw Normal View History

2026-02-27 18:41:34 +01:00
{ rust-bin, makeRustPlatform, perl, pkg-config, cmake }:
2026-02-23 15:58:29 +01:00
let
rustToolchain = rust-bin.fromRustupToolchainFile ../vendor/libchat/rust_toolchain.toml;
rPlatform = makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
in rPlatform.buildRustPackage {
2026-02-23 20:21:55 +01:00
pname = "libchat";
2026-02-23 15:58:29 +01:00
version = "0.1.0";
src = ../vendor/libchat;
cargoLock = {
lockFile = ../vendor/libchat/Cargo.lock;
outputHashes = {
"chat-proto-0.1.0" = "sha256-aCl80VOIkd/GK3gnmRuFoSAvPBfeE/FKCaNlLt5AbUU=";
};
};
nativeBuildInputs = [ perl pkg-config cmake ];
doCheck = false;
installPhase = ''
runHook preInstall
mkdir -p $out/lib
2026-02-23 20:21:55 +01:00
cp target/*/release/liblibchat.so $out/lib/ 2>/dev/null || true
cp target/*/release/liblibchat.dylib $out/lib/ 2>/dev/null || true
cp target/*/release/liblibchat.a $out/lib/ 2>/dev/null || true
2026-02-23 15:58:29 +01:00
# fallback: non-cross build path
2026-02-23 20:21:55 +01:00
cp target/release/liblibchat.so $out/lib/ 2>/dev/null || true
cp target/release/liblibchat.dylib $out/lib/ 2>/dev/null || true
cp target/release/liblibchat.a $out/lib/ 2>/dev/null || true
2026-02-23 15:58:29 +01:00
runHook postInstall
'';
}