nixpkgs/pkgs/applications/misc/prusa-slicer/default.nix

117 lines
3.3 KiB
Nix
Raw Normal View History

2021-01-15 19:42:12 +01:00
{ stdenv, lib, fetchFromGitHub, cmake, copyDesktopItems, makeDesktopItem, pkg-config, wrapGAppsHook
, boost, cereal, cgal_5, curl, dbus, eigen, expat, glew, glib, gmp, gtest, gtk3, hicolor-icon-theme
, ilmbase, libpng, mpfr, nlopt, openvdb, pcre, qhull, systemd, tbb, wxGTK31-gtk3, xorg
}:
stdenv.mkDerivation rec {
pname = "prusa-slicer";
2021-04-22 17:51:44 +02:00
version = "2.3.1";
nativeBuildInputs = [
cmake
2021-01-15 19:42:12 +01:00
copyDesktopItems
pkg-config
2021-01-15 19:42:12 +01:00
wrapGAppsHook
];
buildInputs = [
boost
2019-09-23 19:33:04 +02:00
cereal
cgal_5
curl
2021-01-15 19:42:12 +01:00
dbus
eigen
expat
glew
2021-01-15 19:42:12 +01:00
glib
gmp
2021-01-15 19:42:12 +01:00
gtk3
hicolor-icon-theme
ilmbase
libpng
mpfr
nlopt
openvdb
2021-01-15 19:42:12 +01:00
pcre
systemd
tbb
2021-01-15 19:42:12 +01:00
wxGTK31-gtk3
xorg.libX11
] ++ checkInputs;
2021-01-15 19:42:12 +01:00
doCheck = true;
checkInputs = [ gtest ];
# The build system uses custom logic - defined in
# cmake/modules/FindNLopt.cmake in the package source - for finding the nlopt
# library, which doesn't pick up the package in the nix store. We
# additionally need to set the path via the NLOPT environment variable.
2019-09-09 01:38:31 +02:00
NLOPT = nlopt;
# Disable compiler warnings that clutter the build log.
# It seems to be a known issue for Eigen:
# http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221
NIX_CFLAGS_COMPILE = "-Wno-ignored-attributes";
# prusa-slicer uses dlopen on `libudev.so` at runtime
NIX_LDFLAGS = "-ludev";
prePatch = ''
# In nix ioctls.h isn't available from the standard kernel-headers package
2019-09-23 19:33:04 +02:00
# like in other distributions. The copy in glibc seems to be identical to the
# one in the kernel though, so we use that one instead.
sed -i 's|"/usr/include/asm-generic/ioctls.h"|<asm-generic/ioctls.h>|g' src/libslic3r/GCodeSender.cpp
# Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx
# now seems to be integrated into the main lib.
sed -i 's|nlopt_cxx|nlopt|g' cmake/modules/FindNLopt.cmake
'';
src = fetchFromGitHub {
owner = "prusa3d";
repo = "PrusaSlicer";
2021-04-22 17:51:44 +02:00
sha256 = "1lyaxc9nha1cd8p35iam1k1pikp9kfx0fj1l6vb1xb8pgqp02jnn";
rev = "version_${version}";
};
cmakeFlags = [
"-DSLIC3R_FHS=1"
2021-01-15 19:42:12 +01:00
"-DSLIC3R_GTK=3"
];
postInstall = ''
2021-01-15 19:42:12 +01:00
ln -s "$out/bin/prusa-slicer" "$out/bin/prusa-gcodeviewer"
mkdir -p "$out/share/pixmaps/"
ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer.png" "$out/share/pixmaps/PrusaSlicer.png"
2021-01-15 19:42:12 +01:00
ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer-gcodeviewer_192px.png" "$out/share/pixmaps/PrusaSlicer-gcodeviewer.png"
'';
2021-01-15 19:42:12 +01:00
desktopItems = [
(makeDesktopItem {
name = "PrusaSlicer";
exec = "prusa-slicer";
icon = "PrusaSlicer";
comment = "G-code generator for 3D printers";
desktopName = "PrusaSlicer";
genericName = "3D printer tool";
categories = "Development;";
})
(makeDesktopItem {
name = "PrusaSlicer G-code Viewer";
exec = "prusa-gcodeviewer";
icon = "PrusaSlicer-gcodeviewer";
comment = "G-code viewer for 3D printers";
desktopName = "PrusaSlicer G-code Viewer";
genericName = "G-code Viewer";
categories = "Development;";
})
];
meta = with lib; {
description = "G-code generator for 3D printer";
homepage = "https://github.com/prusa3d/PrusaSlicer";
license = licenses.agpl3;
maintainers = with maintainers; [ moredread tweber ];
};
}