Skip to content

Commit

Permalink
kcl: rename kcl-cli to kcl
Browse files Browse the repository at this point in the history
  • Loading branch information
selfuryon committed Jun 10, 2024
1 parent af3aa8d commit 8deb7b0
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 27 deletions.
27 changes: 0 additions & 27 deletions pkgs/by-name/kc/kcl-cli/package.nix

This file was deleted.

63 changes: 63 additions & 0 deletions pkgs/by-name/kc/kcl/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
lib,
buildGoModule,
fetchFromGitHub,
kclvm_cli,
kclvm,
makeWrapper,
testers,
kcl,
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)
'';

passthru.tests.version = testers.testVersion {
package = kcl;
command = "kcl version";
version = "v${version}";
};

meta = with lib; {
description = "A command line interface for KCL programming language";
homepage = "https://github.com/kcl-lang/cli";
license = licenses.asl20;
maintainers = with maintainers; [selfuryon peefy];
mainProgram = "kcl";
};
}

0 comments on commit 8deb7b0

Please sign in to comment.