nixpkgs/pkgs/by-name/kc/kcl/package.nix
Ihar Hrachyshka dd0f03a56c treewide: remove usage of deprecated apple_sdk framework stubs
They are not doing anything right now. This is in preparation for their
complete removal from the tree.

Note: several changes that affect the derivation inputs (e.g. removal of
references to stub paths in build instructions) were left out. They will
be cleaned up the next iteration and will require special care.

Note: this PR is a result of a mix of ugly regex (not AST) based
automation and some manual labor. For reference, the regex automation
part was hacked in: https://github.com/booxter/nix-clean-apple_sdk

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-04-19 20:28:20 -04:00

79 lines
1.8 KiB
Nix

{
buildGoModule,
fetchFromGitHub,
installShellFiles,
kclvm_cli,
kclvm,
lib,
nix-update-script,
stdenv,
}:
buildGoModule rec {
pname = "kcl";
version = "0.11.1";
src = fetchFromGitHub {
owner = "kcl-lang";
repo = "cli";
rev = "v${version}";
hash = "sha256-Ron+8pK/1VYwL0HO97QvBpWhKeAlhM+sVi1Djc++4n4=";
};
vendorHash = "sha256-yvhRHzVIkPE7ZDaX+98K4PW3/uh/6esxc/1KwpOvGfY=";
subPackages = [ "cmd/kcl" ];
ldflags = [
"-w -s"
"-X=kcl-lang.io/cli/pkg/version.version=v${version}"
];
nativeBuildInputs = [
installShellFiles
];
buildInputs = [
kclvm
kclvm_cli
];
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
'';
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;
doCheck = true;
updateScript = nix-update-script { };
meta = {
description = "A command line interface for KCL programming language";
changelog = "https://github.com/kcl-lang/cli/releases/tag/v${version}";
homepage = "https://github.com/kcl-lang/cli";
license = lib.licenses.asl20;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
maintainers = with lib.maintainers; [
peefy
selfuryon
];
mainProgram = "kcl";
broken = stdenv.buildPlatform != stdenv.hostPlatform;
};
}