Files
nixpkgs/pkgs/by-name/yf/yffi/package.nix
Dark Steveneq 646b892680
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
push sheeet
2025-10-09 14:15:47 +02:00

51 lines
1.2 KiB
Nix

{
fetchFromGitHub,
lib,
rust-cbindgen,
rustPlatform,
stdenv,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "yffi";
version = "0.24.0";
src = fetchFromGitHub {
owner = "y-crdt";
repo = "y-crdt";
tag = "v${finalAttrs.version}";
hash = "sha256-RFdLEsKQxt8BGqbf5FFM7mZD64glW7bTKRJaAQOe+vo=";
};
cargoHash = "sha256-RL9lBc7lSmc6jOavE5lZupmaNGZgQhJBedNhjfHVajg=";
buildAndTestSubdir = "yffi";
nativeBuildInputs = [
rust-cbindgen
];
postBuild = ''
cbindgen --config yffi/cbindgen.toml --crate yffi --output libyrs.h --lang C
'';
postCheck = ''
$CXX -o yrs-ffi-tests -I . tests-ffi/main.cpp target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/libyrs.a
./yrs-ffi-tests
'';
postInstall = ''
install -Dm644 libyrs.h $out/include/libyrs.h
'';
meta = {
description = "C foreign function interface for Yrs";
homepage = "https://github.com/y-crdt/y-crdt/tree/main/yffi";
downloadPage = "https://github.com/y-crdt/y-crdt/tags";
changelog = "https://github.com/y-crdt/y-crdt/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
teams = with lib.teams; [ ngi ];
platforms = with lib.platforms; linux;
};
})