nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, autoPatchelfHook, makeDesktopItem, copyDesktopItems, wrapGAppsHook, fetchurl
2, alsa-lib, at-spi2-atk, at-spi2-core, atk, cairo, cups
3, gtk3, nss, glib, dbus, nspr, gdk-pixbuf, libdrm, mesa
4, libX11, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext
5, libXfixes, libXi, libXrandr, libXrender, libXtst, libxcb, pango
6, gcc-unwrapped, udev
7}:
8
9stdenv.mkDerivation rec {
10 pname = "snapmaker-luban";
11 version = "4.8.0";
12
13 src = fetchurl {
14 url = "https://github.com/Snapmaker/Luban/releases/download/v${version}/snapmaker-luban-${version}-linux-x64.tar.gz";
15 sha256 = "sha256-uY8MlLIZrbds5/QdYZFTLSSis0BwRU19XfLiBX+2VCY=";
16 };
17
18 nativeBuildInputs = [
19 autoPatchelfHook
20 wrapGAppsHook
21 copyDesktopItems
22 ];
23
24 buildInputs = [
25 alsa-lib
26 at-spi2-atk
27 at-spi2-core
28 cairo
29 cups
30 gcc-unwrapped
31 gtk3
32 libdrm
33 libXdamage
34 libX11
35 libXScrnSaver
36 libXtst
37 libxcb
38 mesa # Required for libgbm
39 nspr
40 nss
41 ];
42
43 libPath = lib.makeLibraryPath [
44 stdenv.cc.cc alsa-lib atk at-spi2-atk at-spi2-core cairo cups
45 gdk-pixbuf glib gtk3 libX11 libXcomposite
46 libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
47 libXtst nspr nss libxcb pango libXScrnSaver udev
48 ];
49
50 autoPatchelfIgnoreMissingDeps = [
51 "libc.musl-x86_64.so.1"
52 ];
53
54 dontWrapGApps = true;
55 dontConfigure = true;
56 dontBuild = true;
57
58 installPhase = ''
59 runHook preInstall
60
61 mkdir -p $out/{bin,opt,share/pixmaps}/
62 mv * $out/opt/
63
64 patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
65 $out/opt/snapmaker-luban
66
67 wrapProgram $out/opt/snapmaker-luban \
68 "''${gappsWrapperArgs[@]}" \
69 --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
70 --prefix LD_LIBRARY_PATH : ${libPath}:$out/snapmaker-luban
71
72 ln -s $out/opt/snapmaker-luban $out/bin/snapmaker-luban
73 ln -s $out/opt/resources/app/app/resources/images/snap-luban-logo-64x64.png $out/share/pixmaps/snapmaker-luban.png
74
75 runHook postInstall
76 '';
77
78 desktopItems = [
79 (makeDesktopItem {
80 name = pname;
81 exec = "snapmaker-luban";
82 icon = "snapmaker-luban";
83 desktopName = "Snapmaker Luban";
84 genericName = meta.description;
85 categories = [ "Office" "Printing" ];
86 })
87 ];
88
89 meta = with lib; {
90 description = "Snapmaker Luban is an easy-to-use 3-in-1 software tailor-made for Snapmaker machines";
91 homepage = "https://github.com/Snapmaker/Luban";
92 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
93 license = licenses.gpl3;
94 maintainers = [ maintainers.simonkampe ];
95 platforms = [ "x86_64-linux" ];
96 };
97}