-
-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
}; | ||
} |