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