1 { lib, stdenv, fetchFromGitHub, perl, makeWrapper
2 , makeDesktopItem, which, perlPackages, boost
5 stdenv.mkDerivation rec {
9 src = fetchFromGitHub {
13 sha256 = "sha256-cf0QTOzhLyTcbJryCQoTVzU8kfrPV6SLpqi4s36X5N0=";
16 nativeBuildInputs = [ makeWrapper which ];
19 (with perlPackages; [ perl
20 EncodeLocale MathClipper ExtUtilsXSpp
21 MathConvexHullMonotoneChain MathGeometryVoronoi MathPlanePath Moo
22 IOStringy ClassXSAccessor Wx GrowlGNTP NetDBus ImportInto XMLSAX
23 ExtUtilsMakeMaker OpenGL WxGLCanvas ModuleBuild LWP
24 ExtUtilsCppGuess ModuleBuildWithXSpp ExtUtilsTypemapsDefault
25 DevelChecklib locallib
28 desktopItem = makeDesktopItem {
32 comment = "G-code generator for 3D printers";
33 desktopName = "Slic3r";
34 genericName = "3D printer tool";
35 categories = [ "Development" ];
39 # In nix ioctls.h isn't available from the standard kernel-headers package
40 # on other distributions. As the copy in glibc seems to be identical to the
41 # one in the kernel, we use that one instead.
42 sed -i 's|"/usr/include/asm-generic/ioctls.h"|<asm-generic/ioctls.h>|g' xs/src/libslic3r/GCodeSender.cpp
45 # note the boost-compile-error is fixed in
46 # https://github.com/slic3r/Slic3r/commit/90f108ae8e7a4315f82e317f2141733418d86a68
47 # this patch can be probably be removed in the next version after 1.3.0
48 patches = lib.optional (lib.versionAtLeast boost.version "1.56.0") ./boost-compile-error.patch;
51 export SLIC3R_NO_AUTO=true
53 export PERL5LIB="./xs/blib/arch/:./xs/blib/lib:$PERL5LIB"
55 substituteInPlace Build.PL \
56 --replace "0.9918" "0.9923" \
68 mkdir -p "$out/share/slic3r/"
69 cp -r * "$out/share/slic3r/"
70 wrapProgram "$out/share/slic3r/slic3r.pl" \
71 --prefix PERL5LIB : "$out/share/slic3r/xs/blib/arch:$out/share/slic3r/xs/blib/lib:$PERL5LIB"
73 ln -s "$out/share/slic3r/slic3r.pl" "$out/bin/slic3r"
74 mkdir -p "$out/share/pixmaps/"
75 ln -s "$out/share/slic3r/var/Slic3r.png" "$out/share/pixmaps/slic3r.png"
76 mkdir -p "$out/share/applications"
77 cp "$desktopItem"/share/applications/* "$out/share/applications/"
81 description = "G-code generator for 3D printers";
83 Slic3r is the tool you need to convert a digital 3D model into printing
84 instructions for your 3D printer. It cuts the model into horizontal
85 slices (layers), generates toolpaths to fill them and calculates the
86 amount of material to be extruded.'';
87 homepage = "https://slic3r.org/";
88 license = licenses.agpl3;
89 platforms = platforms.linux;
90 maintainers = with maintainers; [ bjornfor ];