2024-06-10 10:51:31 +00:00
|
|
|
{ lib
|
2024-07-25 15:37:49 +00:00
|
|
|
, stdenv
|
2024-06-10 10:51:31 +00:00
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, protobuf
|
|
|
|
, pkg-config
|
2024-07-25 15:37:49 +00:00
|
|
|
, darwin
|
|
|
|
, rustc
|
2024-06-10 10:51:31 +00:00
|
|
|
,
|
|
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "kclvm";
|
2024-07-25 15:37:49 +00:00
|
|
|
version = "0.9.3";
|
2024-06-10 10:51:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kcl-lang";
|
|
|
|
repo = "kcl";
|
|
|
|
rev = "v${version}";
|
2024-07-25 15:37:49 +00:00
|
|
|
hash = "sha256-nk5oJRTBRj0LE2URJqno8AoZ+/342C2tEt8d6k2MAc8=";
|
2024-06-10 10:51:31 +00:00
|
|
|
};
|
|
|
|
|
2024-08-02 12:53:11 +00:00
|
|
|
sourceRoot = "${src.name}/kclvm";
|
2024-06-10 10:51:31 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"inkwell-0.2.0" = "sha256-JxSlhShb3JPhsXK8nGFi2uGPp8XqZUSiqniLBrhr+sM=";
|
2024-07-25 15:37:49 +00:00
|
|
|
"protoc-bin-vendored-3.1.0" = "sha256-RRqpPMJygpKGG5NYzD93iy4htpVqFhYMmfPgbRtpUqg=";
|
2024-06-10 10:51:31 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-09-24 15:50:49 +00:00
|
|
|
buildInputs = [ rustc ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-07-25 15:37:49 +00:00
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
darwin.apple_sdk.frameworks.CoreServices
|
|
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
|
|
];
|
|
|
|
|
|
|
|
|
2024-09-24 15:50:49 +00:00
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2024-07-25 15:37:49 +00:00
|
|
|
install_name_tool -id $out/lib/libkclvm_cli_cdylib.dylib $out/lib/libkclvm_cli_cdylib.dylib
|
|
|
|
'';
|
|
|
|
|
2024-06-10 10:51:31 +00:00
|
|
|
nativeBuildInputs = [ pkg-config protobuf ];
|
|
|
|
|
|
|
|
patches = [ ./enable_protoc_env.patch ];
|
|
|
|
|
|
|
|
PROTOC = "${protobuf}/bin/protoc";
|
|
|
|
PROTOC_INCLUDE = "${protobuf}/include";
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A high-performance implementation of KCL written in Rust that uses LLVM as the compiler backend";
|
|
|
|
homepage = "https://github.com/kcl-lang/kcl";
|
|
|
|
license = licenses.asl20;
|
2024-07-25 15:37:49 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2024-06-10 10:51:31 +00:00
|
|
|
maintainers = with maintainers; [ selfuryon peefy ];
|
|
|
|
};
|
|
|
|
}
|