mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 11:10:03 +00:00
Merge pull request #317827 from selfuryon/chore/kcl-refactor
kcl: refactor
This commit is contained in:
commit
7d1463ec48
|
@ -1,27 +0,0 @@
|
|||
{ lib
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "kcl-cli";
|
||||
version = "0.8.9";
|
||||
src = fetchFromGitHub {
|
||||
owner = "kcl-lang";
|
||||
repo = "cli";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-slU3n7YCV5VfvXArzlcITb9epdu/gyXlAWq9KLjGdJA=";
|
||||
};
|
||||
vendorHash = "sha256-Xv8Tfq9Kb1xGFCWZQwBFDX9xZW9j99td/DUb7jBtkpE=";
|
||||
ldflags = [
|
||||
"-X=kcl-lang.io/cli/pkg/version.version=${version}"
|
||||
];
|
||||
subPackages = [ "cmd/kcl" ];
|
||||
meta = with lib; {
|
||||
description = "Command line interface for KCL programming language";
|
||||
homepage = "https://github.com/kcl-lang/cli";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ peefy ];
|
||||
mainProgram = "kcl";
|
||||
};
|
||||
}
|
56
pkgs/by-name/kc/kcl/package.nix
Normal file
56
pkgs/by-name/kc/kcl/package.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{ lib
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, kclvm_cli
|
||||
, kclvm
|
||||
, makeWrapper
|
||||
, installShellFiles
|
||||
,
|
||||
}:
|
||||
buildGoModule rec {
|
||||
pname = "kcl";
|
||||
version = "0.8.9";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kcl-lang";
|
||||
repo = "cli";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-slU3n7YCV5VfvXArzlcITb9epdu/gyXlAWq9KLjGdJA=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-Xv8Tfq9Kb1xGFCWZQwBFDX9xZW9j99td/DUb7jBtkpE=";
|
||||
|
||||
ldflags = [
|
||||
"-w -s"
|
||||
"-X=kcl-lang.io/cli/pkg/version.version=v${version}"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
||||
buildInputs = [ kclvm kclvm_cli ];
|
||||
|
||||
subPackages = [ "cmd/kcl" ];
|
||||
|
||||
# env vars https://github.com/kcl-lang/kcl-go/blob/main/pkg/env/env.go#L29
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/kcl \
|
||||
--set PATH ${lib.makeBinPath [kclvm_cli]} \
|
||||
--set KCL_LIB_HOME ${lib.makeLibraryPath [kclvm]} \
|
||||
--set KCL_GO_DISABLE_INSTALL_ARTIFACT false \
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
installShellCompletion --cmd kcl \
|
||||
--bash <($out/bin/kcl completion bash) \
|
||||
--fish <($out/bin/kcl completion fish) \
|
||||
--zsh <($out/bin/kcl completion zsh)
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A command line interface for KCL programming language";
|
||||
homepage = "https://github.com/kcl-lang/cli";
|
||||
license = licenses.asl20;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ selfuryon peefy ];
|
||||
mainProgram = "kcl";
|
||||
};
|
||||
}
|
4375
pkgs/by-name/kc/kclvm/Cargo.lock
generated
Normal file
4375
pkgs/by-name/kc/kclvm/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
37
pkgs/by-name/kc/kclvm/enable_protoc_env.patch
Normal file
37
pkgs/by-name/kc/kclvm/enable_protoc_env.patch
Normal file
|
@ -0,0 +1,37 @@
|
|||
diff --git a/api/build.rs b/api/build.rs
|
||||
index 617c1b9a..20d728e3 100644
|
||||
--- a/api/build.rs
|
||||
+++ b/api/build.rs
|
||||
@@ -5,10 +5,10 @@ use prost_wkt_build::{FileDescriptorSet, Message};
|
||||
/// According to the file kclvm/spec/gpyrpc/gpyrpc.proto, automatically generate
|
||||
/// the corresponding rust source file to the directory src/model
|
||||
fn main() {
|
||||
- std::env::set_var(
|
||||
- "PROTOC",
|
||||
- protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
|
||||
- );
|
||||
+ // std::env::set_var(
|
||||
+ // "PROTOC",
|
||||
+ // protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
|
||||
+ // );
|
||||
|
||||
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
let descriptor_file = out.join("kclvm_service_descriptor.bin");
|
||||
diff --git b/third-party/prost-wkt/wkt-types/build.rs a/third-party/prost-wkt/wkt-types/build.rs
|
||||
index e49222d5..a933ddf4 100644
|
||||
--- a/third-party/prost-wkt/wkt-types/build.rs
|
||||
+++ b/third-party/prost-wkt/wkt-types/build.rs
|
||||
@@ -13,10 +13,10 @@ use regex::Regex;
|
||||
|
||||
fn main() {
|
||||
//hack: set protoc_bin_vendored::protoc_bin_path() to PROTOC
|
||||
- std::env::set_var(
|
||||
- "PROTOC",
|
||||
- protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
|
||||
- );
|
||||
+ // std::env::set_var(
|
||||
+ // "PROTOC",
|
||||
+ // protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
|
||||
+ // );
|
||||
let dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
process_prost_pbtime(&dir);
|
41
pkgs/by-name/kc/kclvm/package.nix
Normal file
41
pkgs/by-name/kc/kclvm/package.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, protobuf
|
||||
, pkg-config
|
||||
,
|
||||
}:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "kclvm";
|
||||
version = "0.8.7";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kcl-lang";
|
||||
repo = "kcl";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-ieGpuNkzT6AODZYUcEanb7Jpb+PXclnQ9KkdmlehK0o=";
|
||||
};
|
||||
|
||||
sourceRoot = "source/kclvm";
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
outputHashes = {
|
||||
"inkwell-0.2.0" = "sha256-JxSlhShb3JPhsXK8nGFi2uGPp8XqZUSiqniLBrhr+sM=";
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ selfuryon peefy ];
|
||||
};
|
||||
}
|
7
pkgs/by-name/kc/kclvm_cli/Cargo.lock
generated
Normal file
7
pkgs/by-name/kc/kclvm_cli/Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "kclvm_cli"
|
||||
version = "0.8.7"
|
10
pkgs/by-name/kc/kclvm_cli/cargo_lock.patch
Normal file
10
pkgs/by-name/kc/kclvm_cli/cargo_lock.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- /dev/null 2024-03-29 17:01:59.989114590 +0100
|
||||
+++ cli/Cargo.lock 2024-04-17 13:27:32.243365234 +0200
|
||||
@@ -0,0 +1,7 @@
|
||||
+# This file is automatically @generated by Cargo.
|
||||
+# It is not intended for manual editing.
|
||||
+version = 3
|
||||
+
|
||||
+[[package]]
|
||||
+name = "kclvm_cli"
|
||||
+version = "0.8.7"
|
31
pkgs/by-name/kc/kclvm_cli/package.nix
Normal file
31
pkgs/by-name/kc/kclvm_cli/package.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, kclvm
|
||||
}:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "kclvm_cli";
|
||||
version = "0.8.7";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kcl-lang";
|
||||
repo = "kcl";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-ieGpuNkzT6AODZYUcEanb7Jpb+PXclnQ9KkdmlehK0o=";
|
||||
};
|
||||
|
||||
sourceRoot = "source/cli";
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
cargoPatches = [ ./cargo_lock.patch ];
|
||||
|
||||
buildInputs = [ kclvm ];
|
||||
|
||||
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;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ selfuryon peefy ];
|
||||
mainProgram = "kclvm_cli";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue