Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 python3, 4 fetchFromGitHub, 5 gettext, 6}: 7let 8 version = "3.1.0"; 9 dependencies = 10 with python3.pkgs; 11 [ 12 pyembroidery 13 inkex 14 wxpython 15 networkx 16 shapely 17 lxml 18 appdirs 19 numpy 20 jinja2 21 requests 22 # Upstream wants colormath2 yet still refers to it as colormath. Curious. 23 colormath 24 flask 25 fonttools 26 trimesh 27 scipy 28 diskcache 29 flask-cors 30 ] 31 # Inkstitch uses the builtin tomllib instead when Python >=3.11 32 ++ lib.optional (pythonOlder "3.11") tomli; 33 pyEnv = python3.withPackages (_: dependencies); 34in 35python3.pkgs.buildPythonApplication { 36 pname = "inkstitch"; 37 inherit version; 38 pyproject = false; # Uses a Makefile (yikes) 39 40 src = fetchFromGitHub { 41 owner = "inkstitch"; 42 repo = "inkstitch"; 43 tag = "v${version}"; 44 hash = "sha256-CGhJsDRhElgemNv2BXqZr6Vi5EyBArFak7Duz545ivY="; 45 }; 46 47 nativeBuildInputs = [ 48 gettext 49 pyEnv 50 ]; 51 52 inherit dependencies; 53 54 env = { 55 # to overwrite version string 56 GITHUB_REF = version; 57 BUILD = "nixpkgs"; 58 }; 59 makeFlags = [ "manual" ]; 60 61 installPhase = '' 62 runHook preInstall 63 64 mkdir -p $out/share/inkscape/extensions 65 cp -a . $out/share/inkscape/extensions/inkstitch 66 67 runHook postInstall 68 ''; 69 70 patches = [ 71 ./0001-force-frozen-true.patch 72 ./0002-plugin-invocation-use-python-script-as-entrypoint.patch 73 ]; 74 75 postPatch = '' 76 # Add shebang with python dependencies 77 substituteInPlace lib/inx/utils.py --replace-fail ' interpreter="python"' "" 78 sed -i -e '1i#!${pyEnv.interpreter}' inkstitch.py 79 chmod a+x inkstitch.py 80 ''; 81 82 nativeCheckInputs = with python3.pkgs; [ 83 pytestCheckHook 84 ]; 85 86 meta = { 87 description = "Inkscape extension for machine embroidery design"; 88 homepage = "https://inkstitch.org/"; 89 license = with lib.licenses; [ gpl3Plus ]; 90 maintainers = with lib.maintainers; [ 91 tropf 92 pluiedev 93 ]; 94 }; 95}