From 455746e2d4f7da148b0fbc0b1984b22cdd332ad2 Mon Sep 17 00:00:00 2001 From: Alexis Williams Date: Tue, 24 Mar 2026 14:51:47 -0700 Subject: [PATCH] hk: init at 1.48.0 --- pkgs/by-name/hk/hk/package.nix | 78 ++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 pkgs/by-name/hk/hk/package.nix diff --git a/pkgs/by-name/hk/hk/package.nix b/pkgs/by-name/hk/hk/package.nix new file mode 100644 index 000000000000..6e2ebfa81cd8 --- /dev/null +++ b/pkgs/by-name/hk/hk/package.nix @@ -0,0 +1,78 @@ +{ + lib, + stdenv, + rustPlatform, + fetchFromGitHub, + installShellFiles, + versionCheckHook, + nix-update-script, + pkg-config, + libgit2, + openssl, + usage, +}: + +rustPlatform.buildRustPackage (finalAttrs: { + pname = "hk"; + version = "1.48.0"; + + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "jdx"; + repo = "hk"; + tag = "v${finalAttrs.version}"; + hash = "sha256-jQVEKyFdzeVLBKkX3/zjJBXawxR6ayuf+8wSingESZA="; + }; + + cargoHash = "sha256-QzjoLnHlGTdnNfsfaRn7ZVeTwQZumN87IOhubLcEDLQ="; + + nativeBuildInputs = [ + installShellFiles + versionCheckHook + pkg-config + usage + ]; + + buildInputs = [ + libgit2 + openssl + ]; + + # These tests require external dependencies and are fragile -- skipping. + checkFlags = [ + "--skip=cli::init::detector::tests::test_detect_builtins_with_cargo_toml" + "--skip=cli::init::detector::tests::test_detect_builtins_with_package_json" + "--skip=cli::init::detector::tests::test_detect_eslint_with_contains" + "--skip=cli::init::detector::tests::test_detect_shell_scripts" + "--skip=cli::util::python_check_ast::tests::test_invalid_python" + "--skip=settings::tests::test_settings_builder_fluent_api" + "--skip=settings::tests::test_settings_from_config" + "--skip=settings::tests::test_settings_snapshot_caching" + ]; + + cargoBuildFlags = [ + "--bin" + "hk" + ]; + + cargoTestFlags = [ "--all-features" ]; + + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd hk \ + --bash <($out/bin/hk completion bash) \ + --fish <($out/bin/hk completion fish) \ + --zsh <($out/bin/hk completion zsh) + ''; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Tool for managing git hooks"; + homepage = "https://hk.jdx.dev"; + changelog = "https://github.com/jdx/hk/blob/${finalAttrs.src.tag}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ typedrat ]; + mainProgram = "hk"; + }; +})