nixpkgs/pkgs/by-name/kc/kcl/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
1.8 KiB
Nix
Raw Permalink Normal View History

{
buildGoModule,
fetchFromGitHub,
installShellFiles,
kclvm_cli,
kclvm,
lib,
nix-update-script,
stdenv,
2024-06-10 13:53:29 +03:00
}:
buildGoModule rec {
2024-06-10 13:53:29 +03:00
pname = "kcl";
2025-07-26 14:21:51 +00:00
version = "0.11.3";
2024-06-10 13:53:29 +03:00
src = fetchFromGitHub {
owner = "kcl-lang";
repo = "cli";
rev = "v${version}";
2025-07-26 14:21:51 +00:00
hash = "sha256-LJ+Mclw/dMyOeUHg6TAckSbvDGFYCf6mMGzDmiIQVZc=";
2024-06-10 13:53:29 +03:00
};
2025-07-26 14:21:51 +00:00
vendorHash = "sha256-jNQ0g7BGXUoYKV5RkU/f9GrSC3ygeZv83SekAmyKLxc=";
subPackages = [ "cmd/kcl" ];
2024-06-10 13:53:29 +03:00
ldflags = [
"-w -s"
"-X=kcl-lang.io/cli/pkg/version.version=v${version}"
];
nativeBuildInputs = [
installShellFiles
];
buildInputs = [
kclvm
kclvm_cli
];
2024-06-10 13:53:29 +03:00
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
export HOME=$(mktemp -d)
for shell in bash fish zsh; do
installShellCompletion --cmd kcl \
--$shell <($out/bin/kcl completion $shell)
done
'';
2024-12-04 13:30:15 +10:00
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
set -o pipefail
$out/bin/kcl --version | grep $version
$out/bin/kcl <(echo 'hello = "KCL"') | grep "hello: KCL"
runHook postInstallCheck
'';
# By default, libs and bins are stripped. KCL will crash on darwin if they are.
dontStrip = stdenv.hostPlatform.isDarwin;
2024-06-10 13:53:29 +03:00
2024-12-04 13:30:15 +10:00
doCheck = true;
2024-06-10 13:53:29 +03:00
updateScript = nix-update-script { };
2024-06-10 13:53:29 +03:00
meta = {
description = "Command line interface for KCL programming language";
changelog = "https://github.com/kcl-lang/cli/releases/tag/v${version}";
2024-06-10 13:53:29 +03:00
homepage = "https://github.com/kcl-lang/cli";
license = lib.licenses.asl20;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
maintainers = with lib.maintainers; [
peefy
selfuryon
];
2024-06-10 13:53:29 +03:00
mainProgram = "kcl";
broken = stdenv.buildPlatform != stdenv.hostPlatform;
2024-06-10 13:53:29 +03:00
};
}