vsketch in path with python 313

This commit is contained in:
Olaf committed 2026-11-06 08:18:13 +01:00
1 parent a06d15ccd3
commit b138b37378
4 files changed
+217

No files matched your search

+20
View File
@@ -33,3 +33,23 @@ nix build --dry-run '.#darwinConfigurations.aarch64-darwin.pkgs.emacs'
```
The custom Lisp package collection and wrapper may still need local builds.
## vsketch
The local overlay packages vsketch 1.2.0 and its vpype dependencies from pinned
sources. Upstream supports Python 3.11 through 3.13, but not Python 3.14.
On Apple Silicon, the existing Python 3.14 environment remains unchanged;
use `python3.13` to import vsketch. On Intel, vsketch is included in the
existing Python 3.13 environment and can also be imported with `python3`.
Both systems provide the `vsk` and `vpype` commands after applying the
configuration.
Add more Python 3.13 libraries to `vsketchPythonPackages` in
[`overlays/30-vsketch.nix`](overlays/30-vsketch.nix). On Apple Silicon, add
any corresponding command-line executables to the list in `vsketch-python` if
they should also be available on `PATH`.
```sh
python3.13 -c 'import vsketch; print(vsketch.__version__)'
vsk --help
```
+6
View File
@@ -135,6 +135,9 @@ with pkgs;
++ lib.optionals pkgs.stdenv.hostPlatform.isAarch64 [
mlx-lm
]
++ lib.optionals (pkgs.python3.pythonVersion == pkgs.python313.pythonVersion) (
pkgs.vsketchPythonPackages python-pkgs
)
))
# LLM
@@ -211,3 +214,6 @@ with pkgs;
dockutil
]
++ lib.optionals (python3.pythonVersion != python313.pythonVersion) [
vsketch-python
]
+187
View File
@@ -0,0 +1,187 @@
final: prev:
{
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(
python-final: python-prev:
let
pyphenForVpype = python-prev.pyphen.overridePythonAttrs (old: {
version = "0.15.0";
src = final.fetchPypi {
pname = "pyphen";
version = "0.15.0";
hash = "sha256-pDBiPeysU9w2kSQSUyY8uja53XpE/9JoC3Bq82jNovI=";
};
});
in
{
pnoise = python-final.buildPythonPackage rec {
pname = "pnoise";
version = "0.2.0";
pyproject = true;
src = final.fetchPypi {
inherit pname version;
hash = "sha256-djgzENYCvMftI1XNM0+OvFuI5x1b/f7jLRuT05gZcs8=";
};
build-system = with python-final; [
setuptools
wheel
];
dependencies = [ python-final.numpy ];
pythonImportsCheck = [ "pnoise" ];
meta = {
description = "Perlin noise for Python";
homepage = "https://github.com/plottertools/pnoise";
license = final.lib.licenses.lgpl21;
};
};
vpype = python-final.buildPythonPackage rec {
pname = "vpype";
version = "1.15.0";
pyproject = true;
disabled = python-final.pythonOlder "3.11" || python-final.pythonAtLeast "3.14";
src = final.fetchFromGitHub {
owner = "abey79";
repo = "vpype";
rev = version;
hash = "sha256-DIW+4eJuwRsboCbQ/wtqWfXYCR5CqQuAG5jBz992eg8=";
};
nativeBuildInputs = [ final.qt6.wrapQtAppsHook ];
buildInputs = [ final.qt6.qtbase ];
build-system = [ python-final.poetry-core ];
dependencies =
with python-final;
[
asteval
cachetools
click
glcontext
matplotlib
moderngl
multiprocess
numpy
pillow
pnoise
pyside6
scipy
shapely
svgelements
svgwrite
tomli
]
++ [ pyphenForVpype ];
nativeCheckInputs = [ python-final.pytestCheckHook ];
pytestFlags = [
"-o"
"addopts="
];
enabledTestPaths = [
"tests/test_geometry.py"
"tests/test_text.py::test_text_unknown_font"
"tests/test_text.py::test_text_unknown_align"
"tests/test_text.py::test_text_unicode_ok"
];
pythonImportsCheck = [
"vpype"
"vpype_cli"
"vpype_viewer"
];
dontWrapQtApps = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
'';
meta = {
description = "Vector graphics toolbox for pen plotters";
homepage = "https://github.com/abey79/vpype";
license = final.lib.licenses.mit;
mainProgram = "vpype";
};
};
vsketch = python-final.buildPythonPackage rec {
pname = "vsketch";
version = "1.2.0";
pyproject = true;
disabled = python-final.pythonOlder "3.11" || python-final.pythonAtLeast "3.14";
src = final.fetchFromGitHub {
owner = "abey79";
repo = "vsketch";
rev = version;
hash = "sha256-zdBclolZNrpUR4x6A/XkOe7mXEQrE/O56PffzHzPeRM=";
};
nativeBuildInputs = [ final.qt6.wrapQtAppsHook ];
buildInputs = [ final.qt6.qtbase ];
build-system = [ python-final.poetry-core ];
dependencies = with python-final; [
cookiecutter
matplotlib
multiprocess
numpy
pnoise
pyside6
shapely
vpype
watchfiles
];
nativeCheckInputs = [ python-final.pytestCheckHook ];
enabledTestPaths = [
"tests/test_line.py"
"tests/test_param.py"
"tests/test_random.py"
"tests/test_save.py"
"tests/test_sketch.py"
];
pythonImportsCheck = [
"vsketch"
"vsketch_cli.cli"
];
dontWrapQtApps = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
'';
meta = {
description = "Python generative art toolkit for plotters";
homepage = "https://github.com/abey79/vsketch";
license = final.lib.licenses.mit;
mainProgram = "vsk";
};
};
}
)
];
vsketchPythonPackages =
python-pkgs: with python-pkgs; [
vsketch
];
vsketch-python =
let
env = final.python313.withPackages final.vsketchPythonPackages;
in
final.runCommand "vsketch-python-${final.python313.version}" { } ''
mkdir -p "$out/bin"
for executable in python3.13 vsk vpype; do
source="${env}/bin/$executable"
if [ ! -x "$source" ]; then
echo "Missing vsketch executable: $source" >&2
exit 1
fi
ln -s "$source" "$out/bin/$executable"
done
'';
}
+4
View File
@@ -4,3 +4,7 @@ Files in this directory run automatically as part of each build. Some common way
* Applying patches
* Downloading different versions of files (locking to a version or trying a fork)
* Workarounds and stuff I need to run temporarily
Add new overlay files to Git before building (`git add overlays/<name>.nix`).
Git-backed flakes omit untracked files even though they exist locally; a
commit is not required.