nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools-scm,
7 tkinter,
8 tkgl,
9}:
10
11buildPythonPackage rec {
12 pname = "tkinter-gl";
13 version = "1.0";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "3-manifolds";
18 repo = "tkinter_gl";
19 tag = "v${version}_as_released";
20 hash = "sha256-ObI8EEQ7mAOAuV6f+Ld4HH0xkFzqiAZqHDvzjwPA/wM";
21 };
22
23 postPatch = ''
24 # Remove compiled TkGL, we compile it ourselves
25 rm -r src/tkinter_gl/tk
26 # Platform-specific directories are only necessary when using compiled TkGL
27 substituteInPlace src/tkinter_gl/__init__.py \
28 --replace-fail "pkg_dir = os.path.join(__path__[0], 'tk', sys.platform,)" \
29 "pkg_dir = os.path.join(__path__[0], 'tk')"
30 '';
31
32 build-system = [ setuptools-scm ];
33
34 dependencies = [ tkinter ];
35
36 postInstall =
37 let
38 pkgDir = "$out/${python.sitePackages}/tkinter_gl/tk";
39 in
40 ''
41 mkdir -p ${pkgDir}
42 ln -s ${tkgl}/lib/Tkgl* ${pkgDir}
43 '';
44
45 pythonImportsCheck = [ "tkinter_gl" ];
46
47 meta = {
48 description = "Base class for GL rendering surfaces in tkinter";
49 changelog = "https://github.com/3-manifolds/tkinter_gl/releases/tag/${src.tag}";
50 homepage = "https://github.com/3-manifolds/tkinter_gl";
51 license = lib.licenses.gpl2Plus;
52 maintainers = with lib.maintainers; [
53 noiioiu
54 alejo7797
55 ];
56 };
57}