Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / misc / prusa-slicer / super-slicer.nix
blob308c0949f134bae45334b38c0ef76b089969503d
1 { lib, fetchFromGitHub, fetchpatch, makeDesktopItem, wxGTK31, prusa-slicer, libspnav }:
2 let
3   appname = "SuperSlicer";
4   pname = "super-slicer";
5   description = "PrusaSlicer fork with more features and faster development cycle";
7   patches = [
8     # Fix compile error with boost 1.79. See https://github.com/supermerill/SuperSlicer/issues/2823
9     (fetchpatch {
10       url = "https://raw.githubusercontent.com/gentoo/gentoo/81e3ca3b7c131e8345aede89e3bbcd700e1ad567/media-gfx/superslicer/files/superslicer-2.4.58.3-boost-1.79-port-v2.patch";
11       # Excludes Linux-only patches
12       excludes = [
13         "src/slic3r/GUI/FreeCADDialog.cpp"
14         "src/slic3r/GUI/Tab.cpp"
15         "src/slic3r/Utils/Http.cpp"
16       ];
17       sha256 = "sha256-v0q2MhySayij7+qBTE5q01IOq/DyUcWnjpbzB/AV34c=";
18     })
19   ];
21   versions = {
22     stable = {
23       version = "2.3.57.12";
24       sha256 = "sha256-lePhDRHI++9zs54bTt2/Lu6ZQ7egjJCWb752aI0s7Mw==";
25       patches = null;
26     };
27     latest = {
28       version = "2.4.58.5";
29       sha256 = "sha256-UywxEGedXaBUTKojEkbkuejI6SdPSkPxTJMwUDNW6W0=";
30       inherit patches;
31     };
32     beta = {
33       version = "2.5.59.2";
34       sha256 = "sha256-IgE+NWy2DUrPR2ROfK1F67e8B3eoM9yRVQ0GZTxJ42I=";
35       inherit patches;
36     };
37   };
39   override = { version, sha256, patches }: super: {
40     inherit version pname patches;
42     src = fetchFromGitHub {
43       owner = "supermerill";
44       repo = "SuperSlicer";
45       inherit sha256;
46       rev = version;
47       fetchSubmodules = true;
48     };
50     # - wxScintilla is not used on macOS
51     # - Partially applied upstream changes cause a bug when trying to link against a nonexistent libexpat
52     prePatch = super.prePatch + ''
53       substituteInPlace src/CMakeLists.txt \
54         --replace "scintilla" "" \
55         --replace "list(APPEND wxWidgets_LIBRARIES libexpat)" "list(APPEND wxWidgets_LIBRARIES EXPAT::EXPAT)"
57       substituteInPlace src/libslic3r/CMakeLists.txt \
58         --replace "libexpat" "EXPAT::EXPAT"
59     '';
61     # We don't need PS overrides anymore, and gcode-viewer is embedded in the binary.
62     postInstall = null;
63     separateDebugInfo = true;
65     buildInputs = super.buildInputs ++ [
66       libspnav
67     ];
69     desktopItems = [
70       (makeDesktopItem {
71         name = "superslicer";
72         exec = "superslicer";
73         icon = appname;
74         comment = description;
75         desktopName = appname;
76         genericName = "3D printer tool";
77         categories = [ "Development" ];
78       })
79     ];
81     meta = with lib; {
82       inherit description;
83       homepage = "https://github.com/supermerill/SuperSlicer";
84       license = licenses.agpl3;
85       maintainers = with maintainers; [ cab404 moredread tmarkus ];
86       mainProgram = "superslicer";
87     };
89     passthru = allVersions;
91   };
92  wxGTK31-prusa = wxGTK31.overrideAttrs (old: rec {
93     pname = "wxwidgets-prusa3d-patched";
94     version = "3.1.4";
95     src = fetchFromGitHub {
96       owner = "prusa3d";
97       repo = "wxWidgets";
98       rev = "489f6118256853cf5b299d595868641938566cdb";
99       hash = "sha256-xGL5I2+bPjmZGSTYe1L7VAmvLHbwd934o/cxg9baEvQ=";
100       fetchSubmodules = true;
101     };
102   });
103   prusa-slicer-wxGTK-override = prusa-slicer.override { wxGTK-override = wxGTK31-prusa; };
104   allVersions = builtins.mapAttrs (_name: version: (prusa-slicer-wxGTK-override.overrideAttrs (override version))) versions;
106 allVersions.stable