Files
nixpkgs/pkgs/by-name/co/code/package.nix
T
2025-12-14 22:46:42 +08:00

72 lines
1.5 KiB
Nix

{
fetchFromGitHub,
lib,
nix-update-script,
openssl,
pkg-config,
rustPlatform,
stdenvNoCC,
versionCheckHook,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "code";
version = "0.6.5";
src = fetchFromGitHub {
owner = "just-every";
repo = "code";
tag = "v${finalAttrs.version}";
hash = "sha256-X+YwTXla6EePXLhMgokiZkgkm9P/rkl2+2XC27tqAEk=";
};
sourceRoot = "${finalAttrs.src.name}/code-rs";
cargoHash = "sha256-oNrBwI0klqQtGTMhPzVvOqMqvdexEVkZpLD6ssXqQX8=";
nativeBuildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [
pkg-config
];
buildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [
openssl
];
CODE_VERSION = finalAttrs.version;
cargoBuildFlags = [
"--bin"
"code"
"--bin"
"code-tui"
"--bin"
"code-exec"
];
# Takes too much time
doCheck = false;
postInstall = ''
ln -s $out/bin/code $out/bin/coder
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
passthru.updateScript = nix-update-script { };
meta = {
description = "Fast, effective, mind-blowing, coding CLI";
homepage = "https://github.com/just-every/code";
downloadPage = "https://github.com/just-every/code/releases";
changelog = "https://github.com/just-every/code/releases/tag/${finalAttrs.src.tag}";
license = with lib.licenses; [
asl20
mit
];
maintainers = with lib.maintainers; [ prince213 ];
mainProgram = "coder";
priority = 10;
};
})