nixpkgs/pkgs/applications/misc/slic3r/default.nix
Bjørn Forsman 49fccb03e9 slic3r: new package
Slic3r is a G-code generator for 3D printers.

- Math-Clipper and Boost-Geometry-Utils have been bumped to satisfy
  Slic3r.

- Slic3r has problems with perl 5.16 due to a locale issue (comma vs
  period in floating point numbers). So we use perl 5.14.

- The tests fail, so we skip them. According to the author of Slic3r,
  that should be safe:

    "Tests failed because of a typo when the 0.9.10b tag was applied.
    You can safely ignore the test results, Slic3r will work."

  See https://github.com/alexrj/Slic3r/issues/1303

  For reference, the errors look like this:

    Use of uninitialized value $deg in numeric eq (==) at /tmp/nix-build-perl-slic3r-0.9.10b.drv-0/git-export/t/../lib/Slic3r/TriangleMesh.pm line 328.
    # Looks like your test exited with 255 before it could output anything.
2013-07-11 01:35:00 +02:00

62 lines
2.1 KiB
Nix

{ stdenv, fetchgit, perl, makeWrapper, makeDesktopItem
# Perl modules:
, EncodeLocale, MathClipper, ExtUtilsXSpp, BoostGeometryUtils
, MathConvexHullMonotoneChain, MathGeometryVoronoi, MathPlanePath, Moo
, IOStringy, ClassXSAccessor, Wx, GrowlGNTP, NetDBus }:
stdenv.mkDerivation rec {
version = "0.9.10b";
name = "slic3r-${version}";
# Slic3r doesn't put out tarballs, only a git repository is available
src = fetchgit {
url = "git://github.com/alexrj/Slic3r";
rev = "refs/tags/${version}";
sha256 = "0j06h0z65qn4kyb2b7pnq6bcn4al60q227iz9jlrin0ffx3l0ra7";
};
buildInputs = [ perl makeWrapper
EncodeLocale MathClipper ExtUtilsXSpp BoostGeometryUtils
MathConvexHullMonotoneChain MathGeometryVoronoi MathPlanePath Moo
IOStringy ClassXSAccessor Wx GrowlGNTP NetDBus
];
desktopItem = makeDesktopItem {
name = "slic3r";
exec = "slic3r";
icon = "slic3r";
comment = "G-code generator for 3D printers";
desktopName = "Slic3r";
genericName = "3D printer tool";
categories = "Application;Development;";
};
# Nothing to do here
buildPhase = "true";
installPhase = ''
mkdir -p "$out/share/slic3r/"
cp -r * "$out/share/slic3r/"
wrapProgram "$out/share/slic3r/slic3r.pl" --prefix PERL5LIB : $PERL5LIB
mkdir -p "$out/bin"
ln -s "$out/share/slic3r/slic3r.pl" "$out/bin/slic3r"
mkdir -p "$out/share/pixmaps/"
ln -s "$out/share/slic3r/var/Slic3r.png" "$out/share/pixmaps/slic3r.png"
mkdir -p "$out/share/applications"
cp "$desktopItem"/share/applications/* "$out/share/applications/"
'';
meta = with stdenv.lib; {
description = "G-code generator for 3D printers";
longDescription = ''
Slic3r is the tool you need to convert a digital 3D model into printing
instructions for your 3D printer. It cuts the model into horizontal
slices (layers), generates toolpaths to fill them and calculates the
amount of material to be extruded.'';
homepage = http://slic3r.org/;
license = licenses.agpl3;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
}