From 78e1b5423b80a91f33ae3647ff9779e3f5f4b2a0 Mon Sep 17 00:00:00 2001 From: Alexander Lampalzer Date: Wed, 18 Jun 2025 22:56:16 +0200 Subject: [PATCH] foxglove-cli: init at 1.0.23 --- pkgs/by-name/fo/foxglove-cli/package.nix | 85 ++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 pkgs/by-name/fo/foxglove-cli/package.nix diff --git a/pkgs/by-name/fo/foxglove-cli/package.nix b/pkgs/by-name/fo/foxglove-cli/package.nix new file mode 100644 index 000000000000..a177bd518359 --- /dev/null +++ b/pkgs/by-name/fo/foxglove-cli/package.nix @@ -0,0 +1,85 @@ +{ + stdenv, + lib, + buildGoModule, + buildPackages, + fetchFromGitHub, + installShellFiles, + nix-update-script, + versionCheckHook, + writableTmpDirAsHomeHook, +}: +buildGoModule (finalAttrs: { + pname = "foxglove-cli"; + version = "1.0.23"; + + src = fetchFromGitHub { + owner = "foxglove"; + repo = "foxglove-cli"; + tag = "v${finalAttrs.version}"; + hash = "sha256-jJD8sRTiJ4UGouc3KFgdgpjL7AQuU4wdxIaLqd/bih4="; + }; + + vendorHash = "sha256-8WHfXLcpYI2TlXOgjwcuJW61ftTHQEDP0Wc5XZ8ZsCQ="; + + env.CGO_ENABLED = 0; + tags = [ "netgo" ]; + ldflags = [ + "-s" + "-w" + "-X main.Version=${finalAttrs.version}" + ]; + + nativeBuildInputs = [ + installShellFiles + ]; + + modRoot = "foxglove"; + + checkFlags = + let + skippedTests = [ + "TestDoExport" + "TestExport" + "TestExportCommand" + "TestImport" + "TestImportCommand" + "TestLogin" + "TestLoginCommand" + ]; + in + [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ]; + + postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ( + let + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + installShellCompletion --cmd foxglove \ + --bash <(${emulator} $out/bin/foxglove completion bash) \ + --fish <(${emulator} $out/bin/foxglove completion fish) \ + --zsh <(${emulator} $out/bin/foxglove completion zsh) + '' + ); + + passthru.updateScript = nix-update-script { }; + + doInstallCheck = true; + nativeInstallCheckInputs = [ + versionCheckHook + writableTmpDirAsHomeHook + ]; + versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}"; + versionCheckProgramArg = "version"; + versionCheckKeepEnvironment = [ "HOME" ]; + + meta = { + changelog = "https://github.com/foxglove/foxglove-cli/releases/tag/v${finalAttrs.version}"; + description = "Interact with the Foxglove platform"; + downloadPage = "https://github.com/foxglove/foxglove-cli"; + homepage = "https://docs.foxglove.dev/docs/cli"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ sascha8a ]; + mainProgram = "foxglove"; + }; +})