{ lib, config, pkgs, ... }: let py3 = pkgs.python3; py3Pkgs = py3.pkgs; # For 3D CNC machining opencamlib = py3Pkgs.toPythonModule (pkgs.stdenv.mkDerivation rec { pname = "opencamlib"; version = "2019.07"; nativeBuildInputs = (with pkgs;[ cmake git doxygen boost texlive.combined.scheme-full ]); propagatedNativeBuildInputs = (with pkgs; [ py3 py3.pkgs.boost py3.pkgs.vtk ]); postPatch = '' mkdir -p $out/${py3.sitePackages}/{lib,ocl} sed -e 's#LIBRARY DESTINATION ''${PYTHON_ARCH_PACKAGES}#LIBRARY DESTINATION '"$out"'/${py3.sitePackages}#g' -i src/pythonlib/pythonlib.cmake sed -e 's#DESTINATION ''${PYTHON_SITE_PACKAGES}#DESTINATION '"$out"'/${py3.sitePackages}#g' -i src/pythonlib/pythonlib.cmake ''; cmakeFlags = [ "-DVERSION_STRING=2019.07" "-DBUILD_CXX_LIB=ON" "-DBUILD_PY_LIB=ON" "-DUSE_PY_3=ON" "-DCMAKE_BUILD_TYPE=Release" ]; src = pkgs.fetchFromGitHub { owner = "aewallin"; repo = "opencamlib"; rev = "2019.07"; sha256 = "1a8pxp1mh8x3bfsb0l97vgxrpk482p7q9jprkd4m9hv69vva2bdz"; }; }); py3Cad = pkgs.python3.withPackages (p: (with p; [ numpy scipy seaborn pandas matplotlib ipython python-lsp-server opencamlib ])); in { # if you also want support for flakes nixpkgs.overlays = [(self: super: rec { freecad = super.freecad.override { python = py3Cad; }; })]; environment.systemPackages = with pkgs; [ openscad freecad kicad ]; }