openscadPackages.dotscad: init at 3.3

Co-authored-by: Jo <jopejoe1@missing.ninja>
This commit is contained in:
xoconoch
2026-08-23 08:59:25 -06:00
parent df3e37e644
commit 705ae6fc62
2 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
{
lib,
buildOpenSCADPackage,
fetchFromGitHub,
stdenv,
runCommand,
openscad,
libName ? null,
}:
buildOpenSCADPackage (finalAttrs: {
pname = "dotscad";
version = "3.3";
libName = if libName == null then "dotSCAD" else libName;
installTargets = [ "src/*" ];
src = fetchFromGitHub {
owner = "JustinSDK";
repo = "dotSCAD";
tag = "v${finalAttrs.version}";
hash = "sha256-kDT9vDCMMJs65aiQJXSxqhwy0GOo7FJbcIHPUtCSajQ=";
};
passthru = {
tests = lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) {
functionality =
runCommand "test-functionality-${finalAttrs.name}"
{
nativeBuildInputs = [
(openscad.withPackages (ps: [ finalAttrs.finalPackage ]))
];
}
''
set -eu -o pipefail
mkdir -p "$out"
openscad -o "$out"/test.3mf - <<EOF
use <dotSCAD/crystal_ball.scad>
crystal_ball(radius = 6);
EOF
if ! [[ -f "$out/test.3mf" ]]; then
echo "ERROR: $name: test.3mf file not generated by openscad" >&2
exit 1
fi
'';
};
};
meta = {
description = "Reduce the burden of mathematics when playing OpenSCAD";
longDescription = ''
dotSCAD's upstream installation instructions can cause namespace
conflicts. This package installs it under a `dotSCAD/` namespace, so
import paths in the upstream documentation may differ. More info at
https://wiki.nixos.org/wiki/OpenSCAD#Namespace_conflicting_libraries
'';
homepage = "https://github.com/JustinSDK/dotSCAD";
license = lib.licenses.lgpl3Only;
maintainers = with lib.maintainers; [ xoconoch ];
};
})

View File

@@ -14,5 +14,6 @@ lib.makeScope newScope (
openscad = openscadOrig.override { openscadPackages = self; };
bosl = self.callPackage ../development/openscad-packages/bosl { };
bosl2 = self.callPackage ../development/openscad-packages/bosl2 { };
dotscad = self.callPackage ../development/openscad-packages/dotscad { };
}
)