Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 python3Packages, 5 fetchFromGitHub, 6 nix-update-script, 7 glibcLocales, 8 versionCheckHook, 9 withPostgresAdapter ? true, 10 withBigQueryAdapter ? true, 11}: 12python3Packages.buildPythonApplication rec { 13 pname = "harlequin"; 14 version = "2.1.2"; 15 pyproject = true; 16 17 src = fetchFromGitHub { 18 owner = "tconbeer"; 19 repo = "harlequin"; 20 tag = "v${version}"; 21 hash = "sha256-uHzhAI8ppp6aoveMPcLCQX2slhbor5Qy+IoTui+RP7M="; 22 }; 23 24 pythonRelaxDeps = [ 25 "numpy" 26 "pyarrow" 27 "textual" 28 "tree-sitter-sql" 29 ]; 30 31 build-system = with python3Packages; [ poetry-core ]; 32 33 nativeBuildInputs = [ glibcLocales ]; 34 35 dependencies = 36 with python3Packages; 37 [ 38 click 39 duckdb 40 importlib-metadata 41 numpy 42 packaging 43 platformdirs 44 pyarrow 45 questionary 46 rich-click 47 sqlfmt 48 textual 49 textual-fastdatatable 50 textual-textarea 51 tomlkit 52 tree-sitter-sql 53 ] 54 ++ lib.optionals withPostgresAdapter [ harlequin-postgres ] 55 ++ lib.optionals withBigQueryAdapter [ harlequin-bigquery ]; 56 57 pythonImportsCheck = [ 58 "harlequin" 59 "harlequin_duckdb" 60 "harlequin_sqlite" 61 "harlequin_vscode" 62 ]; 63 64 passthru = { 65 updateScript = nix-update-script { }; 66 }; 67 68 preCheck = '' 69 export HOME=$(mktemp -d) 70 ''; 71 72 nativeCheckInputs = with python3Packages; [ 73 pytest-asyncio 74 pytestCheckHook 75 versionCheckHook 76 ]; 77 78 disabledTests = [ 79 # Tests require network access 80 "test_connect_extensions" 81 "test_connect_prql" 82 ] 83 ++ lib.optionals (!stdenv.hostPlatform.isx86_64) [ 84 # Test incorrectly tries to load a dylib/so compiled for x86_64 85 "test_load_extension" 86 ]; 87 88 disabledTestPaths = [ 89 # Tests requires more setup 90 "tests/functional_tests/" 91 ]; 92 93 meta = { 94 description = "SQL IDE for Your Terminal"; 95 homepage = "https://harlequin.sh"; 96 changelog = "https://github.com/tconbeer/harlequin/releases/tag/v${version}"; 97 license = lib.licenses.mit; 98 mainProgram = "harlequin"; 99 maintainers = with lib.maintainers; [ pcboy ]; 100 platforms = lib.platforms.unix; 101 }; 102}