diff --git a/pkgs/by-name/ot/otel-desktop-viewer/package.nix b/pkgs/by-name/ot/otel-desktop-viewer/package.nix index 7eb7e5778385..1fd3594dcd56 100644 --- a/pkgs/by-name/ot/otel-desktop-viewer/package.nix +++ b/pkgs/by-name/ot/otel-desktop-viewer/package.nix @@ -2,49 +2,60 @@ lib, buildGoModule, fetchFromGitHub, - testers, - otel-desktop-viewer, + fetchpatch, stdenv, - apple-sdk_12, + apple-sdk, + versionCheckHook, + nix-update-script, + ... }: -buildGoModule rec { +buildGoModule (finalAttrs: { pname = "otel-desktop-viewer"; - version = "0.1.4"; + version = "0.2.2"; src = fetchFromGitHub { owner = "CtrlSpice"; repo = "otel-desktop-viewer"; - rev = "v${version}"; - hash = "sha256-kMgcco4X7X9WoCCH8iZz5qGr/1dWPSeQOpruTSUnonI="; + rev = "v${finalAttrs.version}"; + hash = "sha256-qvMpebhbg/OnheZIZBoiitGYUUMdTghSwEapblE0DkA="; }; - # https://github.com/CtrlSpice/otel-desktop-viewer/issues/139 - patches = [ ./version-0.1.4.patch ]; - - subPackages = [ "..." ]; - - vendorHash = "sha256-pH16DCYeW8mdnkkRi0zqioovZu9slVc3gAdhMYu2y98="; + # NOTE: This project uses Go workspaces, but 'buildGoModule' does not support + # them at the time of writing; trying to build with 'env.GOWORK = "off"' + # fails with the following error message: + # + # main module (github.com/CtrlSpice/otel-desktop-viewer) does not contain package github.com/CtrlSpice/otel-desktop-viewer/desktopexporter + # + # cf. https://github.com/NixOS/nixpkgs/issues/203039 + proxyVendor = true; + vendorHash = "sha256-1TH9JQDnvhi+b3LDCAooMKgYhPudM7NCNCc+WXtcv/4="; ldflags = [ "-s" "-w" + "-X main.version=${finalAttrs.version}" ]; - buildInputs = lib.optional stdenv.hostPlatform.isDarwin apple-sdk_12; + buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk ]; - passthru.tests.version = testers.testVersion { - inherit version; - package = otel-desktop-viewer; - command = "otel-desktop-viewer --version"; - }; + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}"; + versionCheckProgramArg = "--version"; + + passthru.updateScript = nix-update-script { }; meta = { - changelog = "https://github.com/CtrlSpice/otel-desktop-viewer/releases/tag/v${version}"; + changelog = "https://github.com/CtrlSpice/otel-desktop-viewer/releases/tag/v${finalAttrs.version}"; description = "Receive & visualize OpenTelemtry traces locally within one CLI tool"; homepage = "https://github.com/CtrlSpice/otel-desktop-viewer"; license = lib.licenses.asl20; - maintainers = with lib.maintainers; [ gaelreyrol ]; + maintainers = with lib.maintainers; [ + gaelreyrol + jkachmar + lf- + ]; mainProgram = "otel-desktop-viewer"; }; -} +})