Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 72 lines 1.4 kB view raw
1{ 2 lib, 3 black, 4 buildPythonPackage, 5 click, 6 fetchFromGitHub, 7 gitpython, 8 importlib-metadata, 9 jinja2, 10 platformdirs, 11 poetry-core, 12 pytest-asyncio, 13 pytestCheckHook, 14 pythonOlder, 15 tomli, 16 tqdm, 17}: 18 19buildPythonPackage rec { 20 pname = "sqlfmt"; 21 version = "0.27.0"; 22 pyproject = true; 23 24 disabled = pythonOlder "3.9"; 25 26 src = fetchFromGitHub { 27 owner = "tconbeer"; 28 repo = "sqlfmt"; 29 tag = "v${version}"; 30 hash = "sha256-Yel9SB7KrDqtuZxNx4omz6u4AID8Fk5kFYKBEZD1fuU="; 31 }; 32 33 pythonRelaxDeps = [ "platformdirs" ]; 34 35 build-system = [ poetry-core ]; 36 37 dependencies = [ 38 click 39 importlib-metadata 40 jinja2 41 platformdirs 42 tomli 43 tqdm 44 ]; 45 46 optional-dependencies = { 47 jinjafmt = [ black ]; 48 sqlfmt_primer = [ gitpython ]; 49 }; 50 51 nativeCheckInputs = [ 52 pytest-asyncio 53 pytestCheckHook 54 ] 55 ++ lib.flatten (builtins.attrValues optional-dependencies); 56 57 preCheck = '' 58 export HOME=$(mktemp -d) 59 export PATH="$PATH:$out/bin"; 60 ''; 61 62 pythonImportsCheck = [ "sqlfmt" ]; 63 64 meta = { 65 description = "Sqlfmt formats your dbt SQL files so you don't have to"; 66 homepage = "https://github.com/tconbeer/sqlfmt"; 67 changelog = "https://github.com/tconbeer/sqlfmt/blob/${src.tag}/CHANGELOG.md"; 68 license = lib.licenses.asl20; 69 maintainers = with lib.maintainers; [ pcboy ]; 70 mainProgram = "sqlfmt"; 71 }; 72}