nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at flake-libs 99 lines 2.3 kB view raw
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.250.0"; 14 15 src = fetchFromGitHub { 16 owner = "databricks"; 17 repo = "cli"; 18 rev = "v${finalAttrs.version}"; 19 hash = "sha256-AqXwlt7Aqi0cRoDiUfE1LFOJqtRmySuA6D4RMYOonU4="; 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-tpm7eCjJuRpVnZfMZais1bHVhnQ8DxchaN1/7ljKNOo="; 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 # Use uv venv which doesn't work with nix 54 # https://github.com/astral-sh/uv/issues/4450 55 "TestVenvSuccess" 56 "TestPatchWheel" 57 ]); 58 59 nativeCheckInputs = [ 60 gitMinimal 61 (python3.withPackages ( 62 ps: with ps; [ 63 setuptools 64 wheel 65 ] 66 )) 67 ]; 68 69 preCheck = '' 70 # Some tested depends on git and remote url 71 git init 72 git remote add origin https://github.com/databricks/cli.git 73 ''; 74 75 __darwinAllowLocalNetworking = true; 76 77 nativeInstallCheckInputs = [ 78 versionCheckHook 79 ]; 80 versionCheckProgram = "${placeholder "out"}/bin/databricks"; 81 versionCheckProgramArg = "--version"; 82 doInstallCheck = true; 83 84 passthru = { 85 updateScript = nix-update-script { }; 86 }; 87 88 meta = { 89 description = "Databricks CLI"; 90 mainProgram = "databricks"; 91 homepage = "https://github.com/databricks/cli"; 92 changelog = "https://github.com/databricks/cli/releases/tag/v${finalAttrs.version}"; 93 license = lib.licenses.databricks; 94 maintainers = with lib.maintainers; [ 95 kfollesdal 96 taranarmo 97 ]; 98 }; 99})