Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 gitMinimal, 6 python3, 7 versionCheckHook, 8 nix-update-script, 9}: 10 11buildGoModule (finalAttrs: { 12 pname = "databricks-cli"; 13 version = "0.262.0"; 14 15 src = fetchFromGitHub { 16 owner = "databricks"; 17 repo = "cli"; 18 rev = "v${finalAttrs.version}"; 19 hash = "sha256-grA7HI9gJFgeqNxmd6SboAn9z2QKLok7BayGj2RMYog="; 20 }; 21 22 # Otherwise these tests fail asserting that the version is 0.0.0-dev 23 postPatch = '' 24 substituteInPlace bundle/deploy/terraform/init_test.go \ 25 --replace-fail "cli/0.0.0-dev" "cli/${finalAttrs.version}" 26 ''; 27 28 vendorHash = "sha256-sJyinqKX4irO4rquJ1hxDU/GH4XcyxPGw7qH0ZLgdxU="; 29 30 excludedPackages = [ 31 "bundle/internal" 32 "acceptance" 33 "integration" 34 ]; 35 36 ldflags = [ 37 "-X github.com/databricks/cli/internal/build.buildVersion=${finalAttrs.version}" 38 ]; 39 40 postBuild = '' 41 mv "$GOPATH/bin/cli" "$GOPATH/bin/databricks" 42 ''; 43 44 checkFlags = 45 "-skip=" 46 + (lib.concatStringsSep "|" [ 47 # Need network 48 "TestConsistentDatabricksSdkVersion" 49 "TestTerraformArchiveChecksums" 50 "TestExpandPipelineGlobPaths" 51 "TestRelativePathTranslationDefault" 52 "TestRelativePathTranslationOverride" 53 "TestWorkspaceVerifyProfileForHost" 54 "TestWorkspaceVerifyProfileForHost/default_config_file_with_match" 55 "TestWorkspaceResolveProfileFromHost" 56 "TestWorkspaceResolveProfileFromHost/no_config_file" 57 "TestBundleConfigureDefault" 58 # Use uv venv which doesn't work with nix 59 # https://github.com/astral-sh/uv/issues/4450 60 "TestVenvSuccess" 61 "TestPatchWheel" 62 ]); 63 64 nativeCheckInputs = [ 65 gitMinimal 66 (python3.withPackages ( 67 ps: with ps; [ 68 setuptools 69 wheel 70 ] 71 )) 72 ]; 73 74 preCheck = '' 75 # Some tested depends on git and remote url 76 git init 77 git remote add origin https://github.com/databricks/cli.git 78 ''; 79 80 __darwinAllowLocalNetworking = true; 81 82 nativeInstallCheckInputs = [ 83 versionCheckHook 84 ]; 85 versionCheckProgram = "${placeholder "out"}/bin/databricks"; 86 versionCheckProgramArg = "--version"; 87 doInstallCheck = true; 88 89 passthru = { 90 updateScript = nix-update-script { }; 91 }; 92 93 meta = { 94 description = "Databricks CLI"; 95 mainProgram = "databricks"; 96 homepage = "https://github.com/databricks/cli"; 97 changelog = "https://github.com/databricks/cli/releases/tag/v${finalAttrs.version}"; 98 license = lib.licenses.databricks; 99 maintainers = with lib.maintainers; [ 100 kfollesdal 101 taranarmo 102 ]; 103 }; 104})