Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildPythonPackage, 4 python, 5 fetchFromGitHub, 6 mkdocs, 7 twine, 8 arpeggio, 9 click, 10 future, 11 setuptools, 12 callPackage, 13 gprof2dot, 14 html5lib, 15 jinja2, 16 psutil, 17}: 18 19let 20 textx = buildPythonPackage rec { 21 pname = "textx"; 22 version = "3.0.0"; 23 format = "setuptools"; 24 25 src = fetchFromGitHub { 26 owner = pname; 27 repo = pname; 28 rev = version; 29 hash = "sha256-uZlO82dKtWQQR5+Q7dWk3+ZoUzAjDJ8qzC4UMLCtnBk="; 30 }; 31 32 postPatch = '' 33 substituteInPlace setup.cfg --replace "click >=7.0, <8.0" "click >=7.0" 34 ''; 35 36 outputs = [ 37 "out" 38 "testout" 39 ]; 40 41 nativeBuildInputs = [ 42 mkdocs 43 twine 44 ]; 45 46 propagatedBuildInputs = [ 47 arpeggio 48 click 49 future 50 setuptools 51 ]; 52 53 postInstall = '' 54 # FileNotFoundError: [Errno 2] No such file or directory: '$out/lib/python3.10/site-packages/textx/textx.tx 55 cp "$src/textx/textx.tx" "$out/${python.sitePackages}/${pname}/" 56 57 # Install tests as the tests output. 58 mkdir $testout 59 cp -r tests $testout/tests 60 ''; 61 62 pythonImportsCheck = [ "textx" ]; 63 64 # Circular dependencies, do tests in passthru.tests instead. 65 doCheck = false; 66 67 passthru.tests = { 68 textxTests = callPackage ./tests.nix { 69 inherit 70 textx-data-dsl 71 textx-example-project 72 textx-flow-codegen 73 textx-flow-dsl 74 textx-types-dsl 75 ; 76 }; 77 }; 78 79 meta = with lib; { 80 description = "Domain-specific languages and parsers in Python"; 81 mainProgram = "textx"; 82 homepage = "https://github.com/textx/textx/"; 83 license = licenses.mit; 84 maintainers = with maintainers; [ yuu ]; 85 }; 86 }; 87 88 textx-data-dsl = buildPythonPackage rec { 89 pname = "textx-data-dsl"; 90 version = "1.0.0"; 91 inherit (textx) src; 92 # `format` isn't included in the output of `mk-python-derivation`. 93 # So can't inherit format: `error: attribute 'format' missing`. 94 format = "setuptools"; 95 pathToSourceRoot = "tests/functional/registration/projects/data_dsl"; 96 sourceRoot = "${src.name}/" + pathToSourceRoot; 97 propagatedBuildInputs = [ 98 textx 99 textx-types-dsl 100 ]; 101 meta = with lib; { 102 inherit (textx.meta) license maintainers; 103 description = "Sample textX language for testing"; 104 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 105 }; 106 }; 107 108 textx-flow-codegen = buildPythonPackage rec { 109 pname = "textx-flow-codegen"; 110 version = "1.0.0"; 111 inherit (textx) src; 112 format = "setuptools"; 113 pathToSourceRoot = "tests/functional/registration/projects/flow_codegen"; 114 sourceRoot = "${src.name}/" + pathToSourceRoot; 115 propagatedBuildInputs = [ 116 click 117 textx 118 ]; 119 meta = with lib; { 120 inherit (textx.meta) license maintainers; 121 description = "Sample textX language for testing"; 122 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 123 }; 124 }; 125 126 textx-flow-dsl = buildPythonPackage rec { 127 pname = "textx-flow-dsl"; 128 version = "1.0.0"; 129 inherit (textx) src; 130 format = "setuptools"; 131 pathToSourceRoot = "tests/functional/registration/projects/flow_dsl"; 132 sourceRoot = "${src.name}/" + pathToSourceRoot; 133 propagatedBuildInputs = [ textx ]; 134 meta = with lib; { 135 inherit (textx.meta) license maintainers; 136 description = "Sample textX language for testing"; 137 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 138 }; 139 }; 140 141 textx-types-dsl = buildPythonPackage rec { 142 pname = "textx-types-dsl"; 143 version = "1.0.0"; 144 inherit (textx) src; 145 format = "setuptools"; 146 pathToSourceRoot = "tests/functional/registration/projects/types_dsl"; 147 sourceRoot = "${src.name}/" + pathToSourceRoot; 148 propagatedBuildInputs = [ textx ]; 149 meta = with lib; { 150 inherit (textx.meta) license maintainers; 151 description = "Sample textX language for testing"; 152 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 153 }; 154 }; 155 156 textx-example-project = buildPythonPackage rec { 157 pname = "textx-example-project"; 158 version = "1.0.0"; 159 inherit (textx) src; 160 format = "setuptools"; 161 pathToSourceRoot = "tests/functional/subcommands/example_project"; 162 sourceRoot = "${src.name}/" + pathToSourceRoot; 163 propagatedBuildInputs = [ textx ]; 164 meta = with lib; { 165 inherit (textx.meta) license maintainers; 166 description = "Sample textX sub-command for testing"; 167 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 168 }; 169 }; 170in 171textx