diff --git a/pkgs/by-name/mo/mongodb-atlas-cli/package.nix b/pkgs/by-name/mo/mongodb-atlas-cli/package.nix new file mode 100644 index 000000000000..a7c0ab3fa31e --- /dev/null +++ b/pkgs/by-name/mo/mongodb-atlas-cli/package.nix @@ -0,0 +1,57 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + installShellFiles, + nix-update-script, + testers, + mongodb-atlas-cli, +}: + +buildGoModule rec { + pname = "mongodb-atlas-cli"; + version = "1.42.0"; + + vendorHash = "sha256-5kCaQ4bBRiGjRh65Tx3g5SlwAb+/S8o+z/2x8IqSXDM="; + + src = fetchFromGitHub { + owner = "mongodb"; + repo = "mongodb-atlas-cli"; + rev = "refs/tags/atlascli/v${version}"; + sha256 = "sha256-7umwluhPNhY/AGmVhxITLeoAGJPglRP+1PuXOM6TmBA="; + }; + + nativeBuildInputs = [ installShellFiles ]; + + ldflags = [ + "-s" + "-w" + "-X github.com/mongodb/mongodb-atlas-cli/atlascli/internal/version.GitCommit=${src.rev}" + "-X github.com/mongodb/mongodb-atlas-cli/atlascli/internal/version.Version=v${version}" + ]; + + postInstall = '' + installShellCompletion --cmd atlas \ + --bash <($out/bin/atlas completion bash) \ + --fish <($out/bin/atlas completion fish) \ + --zsh <($out/bin/atlas completion zsh) + ''; + + passthru = { + updateScript = nix-update-script { + extraArgs = [ "--version-regex=atlascli/v(.+)" ]; + }; + tests.version = testers.testVersion { + package = mongodb-atlas-cli; + version = "v${version}"; + }; + }; + + meta = { + homepage = "https://www.mongodb.com/try/download/shell"; + description = "CLI utility to manage MongoDB Atlas from the terminal"; + maintainers = with lib.maintainers; [ aduh95 ]; + license = lib.licenses.asl20; + mainProgram = "atlas"; + }; +}