nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 dpkg,
6 autoPatchelfHook,
7 zlib,
8 libgcc,
9 fontconfig,
10 libX11,
11 lttng-ust,
12 icu,
13 libICE,
14 libSM,
15 libXcursor,
16 openssl,
17 imagemagick,
18 makeWrapper,
19}:
20
21stdenv.mkDerivation (finalAttrs: {
22 pname = "lunacy";
23 version = "11.6";
24
25 src = fetchurl {
26 url = "https://lcdn.icons8.com/setup/Lunacy_${finalAttrs.version}.deb";
27 hash = "sha256-VDd2qBNjCyfOy3vZFaVc3BI8zhQmzEIxYDNws7DIYCc=";
28 };
29
30 buildInputs = [
31 zlib
32 libgcc
33 stdenv.cc.cc
34 lttng-ust
35 fontconfig.lib
36
37 # Runtime deps
38 libICE
39 libSM
40 libX11
41 libXcursor
42 ];
43
44 nativeBuildInputs = [
45 dpkg
46 autoPatchelfHook
47 makeWrapper
48 ];
49
50 # adds to the RPATHS of all shared objects (exe and libs)
51 appendRunpaths =
52 map (pkg: (lib.getLib pkg) + "/lib") [
53 icu
54 openssl
55 stdenv.cc.libc
56 stdenv.cc.cc
57 ]
58 ++ [
59 # technically, this should be in runtimeDependencies but will not work as
60 # "lib" is appended to all elements in the array
61 "${placeholder "out"}/lib/lunacy"
62 ];
63
64 # will add to the RPATH of executable only
65 runtimeDependencies = [
66 libICE
67 libSM
68 libX11
69 libXcursor
70 ];
71
72 dontBuild = true;
73 dontStrip = true;
74
75 installPhase = ''
76 runHook preInstall
77
78 mkdir -p "$out/lib";
79 cp -R "opt/icons8/lunacy" "$out/lib"
80 cp -R "usr/share" "$out/share"
81
82 # Prepare the desktop icon, the upstream icon is 200x200 but the hicolor theme does not
83 # support this resolution. Nearest sizes are 192x192 and 256x256.
84 ${imagemagick}/bin/convert "opt/icons8/lunacy/Assets/LunacyLogo.png" -resize 192x192 lunacy.png
85 install -D lunacy.png "$out/share/icons/hicolor/192x192/apps/lunacy.png"
86
87 runHook postInstall
88 '';
89
90 postInstall = ''
91 substituteInPlace $out/share/applications/lunacy.desktop \
92 --replace-fail "Exec=/opt/icons8/lunacy/Lunacy" "Exec=lunacy" \
93 --replace-fail "Icon=/opt/icons8/lunacy/Assets/LunacyLogo.png" "Icon=lunacy"
94 '';
95
96 postFixup = ''
97 mkdir $out/bin
98
99 # The wrapper is needed instead of a symlink to prevent a random "Unsupported file format" when running the app.
100 makeWrapper "$out/lib/lunacy/Lunacy" "$out/bin/lunacy"
101 '';
102
103 meta = {
104 description = "Free design software that keeps your flow with AI tools and built-in graphics";
105 homepage = "https://icons8.com/lunacy";
106 changelog = "https://lunacy.docs.icons8.com/release-notes/";
107 license = lib.licenses.unfree;
108 maintainers = with lib.maintainers; [
109 eliandoran
110 luftmensch-luftmensch
111 ];
112 platforms = lib.platforms.linux;
113 sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
114 mainProgram = "lunacy";
115 };
116})