{ lib, buildGoModule, fetchFromGitHub, nix-update-script, versionCheckHook, }: buildGoModule (finalAttrs: { pname = "hatchet"; version = "0.8.10"; src = fetchFromGitHub { owner = "simagix"; repo = "hatchet"; tag = "v${finalAttrs.version}"; hash = "sha256-TdZ8yKDpphPQnjMHKVICV0vj8FSWlHsAAa6X1p1gqH0="; }; # Otherwise checks fail with `panic: open /etc/protocols: operation not permitted` when sandboxing is enabled on Darwin # https://github.com/NixOS/nixpkgs/pull/381645#issuecomment-2656211797 modPostBuild = '' substituteInPlace vendor/modernc.org/libc/honnef.co/go/netdb/netdb.go \ --replace-fail '!os.IsNotExist(err)' '!os.IsNotExist(err) && !os.IsPermission(err)' ''; vendorHash = "sha256-2IF6XiZvNZt97NvJc4PdgIG3sc2mw6ezkuMvQb2M3LI="; env.CGO_ENABLED = 0; ldflags = [ "-s" "-w" "-X main.version=v${finalAttrs.version}" "-X main.repo=${finalAttrs.src.owner}/${finalAttrs.src.repo}" ]; postInstall = "mv $out/bin/main $out/bin/${finalAttrs.meta.mainProgram}"; # the tests are using fixture files not available from the git repo. doCheck = false; nativeInstallCheckInputs = [ versionCheckHook ]; doInstallCheck = true; passthru.updateScript = nix-update-script { }; meta = { homepage = "https://github.com/simagix/hatchet"; changelog = "https://github.com/simagix/hatchet/releases/tag/${finalAttrs.src.tag}"; description = "MongoDB JSON Log Analyzer"; maintainers = with lib.maintainers; [ aduh95 ]; license = lib.licenses.asl20; mainProgram = "hatchet"; }; })