Edit: replaced shell.nix content with the proper content
Hi,
First post here
I’d like to use py3dtiles under NixOS. I’m running NixOS 24.05 with Flakes and Home Manager on a fresh install.
As py3dtiles is not on nixpkgs, I’m trying to follow this method to make it available. I’ve used nix-init to generate this py3dtiles.nix
file:
{ lib
, python3
, fetchFromGitLab
}:
python3.pkgs.buildPythonApplication rec {
pname = "py3dtiles";
version = "8.0.2";
pyproject = true;
src = fetchFromGitLab {
owner = "py3dtiles";
repo = "py3dtiles";
rev = "v${version}";
hash = "sha256-Y7tectMpeckx6fO7xNZZOmmjZjuXpI1oogDXjkebE98=";
};
nativeBuildInputs = [
python3.pkgs.setuptools
python3.pkgs.setuptools-scm
python3.pkgs.wheel
];
propagatedBuildInputs = with python3.pkgs; [
cython
earcut
lz4
numba
numpy
psutil
pygltflib
pyproj
pyzmq
];
passthru.optional-dependencies = with python3.pkgs; {
dev = [
line-profiler
mypy
pre-commit
pytest
pytest-benchmark
pytest-cov
types-psutil
types-psycopg2
typing-extensions
];
doc = [
myst-parser
sphinx
sphinx-multiversion
sphinx-rtd-theme
sphinxcontrib-apidoc
];
las = [
laspy
];
pack = [
build
commitizen
twine
wheel
];
ply = [
plyfile
];
postgres = [
psycopg2-binary
];
};
pythonImportsCheck = [ "py3dtiles" ];
meta = with lib; {
description = "Python module to manage 3DTiles format";
homepage = "https://gitlab.com/py3dtiles/py3dtiles";
changelog = "https://gitlab.com/py3dtiles/py3dtiles/-/blob/${src.rev}/CHANGELOG.md";
license = licenses.asl20;
maintainers = with maintainers; [ ];
mainProgram = "py3dtiles";
};
}
And here’s my shell.nix
file:
let
pkgs = import <nixpkgs> {};
python = pkgs.python3.override {
self = python;
packageOverrides = pyfinal: pyprev: {
py3dtiles = pyfinal.callPackage ./py3dtiles.nix { };
};
};
in pkgs.mkShell {
packages = [
(python.withPackages (python-pkgs: [
# select Python packages here
python-pkgs.py3dtiles
python-pkgs.laspy
# python-pkgs.foobar
]))
];
}
Now, running nix-shell
in my dev directory seems to work, as I can now see a Python version available with python --version
(I don’t have any other on the system than the one declared on shell.nix). But trying to run py3dtiles
in the terminal as described here (with or without parameters and options) triggers a command not found
.
Where should I go from here? Any advice very welcome, thanks!