|
| 1 | +{ pkgs, lib, ... }: |
| 2 | + |
| 3 | +let |
| 4 | + version = "0.286.0"; |
| 5 | + databricks-cli = pkgs.buildGoModule { |
| 6 | + pname = "databricks-cli"; |
| 7 | + inherit version; |
| 8 | + |
| 9 | + src = pkgs.fetchFromGitHub { |
| 10 | + owner = "databricks"; |
| 11 | + repo = "cli"; |
| 12 | + rev = "v${version}"; |
| 13 | + hash = "sha256-iCmxHjIYznqed6BMQKtuYHJNFPy+3XrNzSXfhtyzPJk="; |
| 14 | + }; |
| 15 | + |
| 16 | + vendorHash = "sha256-TNUI2VQVKnxTiKQg9Bj3qDK2w3oOjO0rdrtTlFIhTzA="; |
| 17 | + |
| 18 | + excludedPackages = [ |
| 19 | + "bundle/internal" |
| 20 | + "acceptance" |
| 21 | + "integration" |
| 22 | + "tools/testrunner" |
| 23 | + "tools/testmask" |
| 24 | + ]; |
| 25 | + |
| 26 | + postPatch = '' |
| 27 | + substituteInPlace bundle/deploy/terraform/init_test.go \ |
| 28 | + --replace-fail "cli/0.0.0-dev" "cli/${version}" |
| 29 | + ''; |
| 30 | + |
| 31 | + ldflags = [ |
| 32 | + "-X github.com/databricks/cli/internal/build.buildVersion=${version}" |
| 33 | + ]; |
| 34 | + |
| 35 | + postBuild = '' |
| 36 | + mv "$GOPATH/bin/cli" "$GOPATH/bin/databricks" |
| 37 | + ''; |
| 38 | + |
| 39 | + checkFlags = |
| 40 | + "-skip=" |
| 41 | + + (lib.concatStringsSep "|" [ |
| 42 | + # Need network |
| 43 | + "TestConsistentDatabricksSdkVersion" |
| 44 | + "TestTerraformArchiveChecksums" |
| 45 | + "TestExpandPipelineGlobPaths" |
| 46 | + "TestRelativePathTranslationDefault" |
| 47 | + "TestRelativePathTranslationOverride" |
| 48 | + "TestWorkspaceVerifyProfileForHost" |
| 49 | + "TestWorkspaceVerifyProfileForHost/default_config_file_with_match" |
| 50 | + "TestWorkspaceResolveProfileFromHost" |
| 51 | + "TestWorkspaceResolveProfileFromHost/no_config_file" |
| 52 | + "TestBundleConfigureDefault" |
| 53 | + # Use uv venv which doesn't work with nix |
| 54 | + # https://github.com/astral-sh/uv/issues/4450 |
| 55 | + "TestVenvSuccess" |
| 56 | + "TestPatchWheel" |
| 57 | + # Fails in nix sandbox due to missing home/cache directory |
| 58 | + "TestCacheDirEnvVar" |
| 59 | + ]); |
| 60 | + |
| 61 | + nativeCheckInputs = [ |
| 62 | + pkgs.gitMinimal |
| 63 | + (pkgs.python3.withPackages ( |
| 64 | + ps: with ps; [ |
| 65 | + setuptools |
| 66 | + wheel |
| 67 | + ] |
| 68 | + )) |
| 69 | + ]; |
| 70 | + |
| 71 | + preCheck = '' |
| 72 | + # Some tests depend on git and remote url |
| 73 | + git init |
| 74 | + git remote add origin https://github.com/databricks/cli.git |
| 75 | + ''; |
| 76 | + |
| 77 | + meta = { |
| 78 | + description = "Databricks CLI"; |
| 79 | + mainProgram = "databricks"; |
| 80 | + homepage = "https://github.com/databricks/cli"; |
| 81 | + changelog = "https://github.com/databricks/cli/releases/tag/v${version}"; |
| 82 | + license = lib.licenses.databricks; |
| 83 | + }; |
| 84 | + }; |
| 85 | +in |
| 86 | +{ |
| 87 | + id = "databricks-cli"; |
| 88 | + name = "Databricks CLI"; |
| 89 | + description = '' |
| 90 | + The Databricks CLI is a command-line tool for interacting with |
| 91 | + Databricks. It provides commands to manage Databricks resources |
| 92 | + such as workspaces, jobs, clusters, libraries, and Databricks |
| 93 | + apps from the command line. |
| 94 | + ''; |
| 95 | + displayVersion = version; |
| 96 | + |
| 97 | + replit.packages = [ |
| 98 | + databricks-cli |
| 99 | + ]; |
| 100 | +} |
0 commit comments