base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / li / linux-wallpaperengine / package.nix
blobd4cf661455e88d45f99fc50db6e3cdf965bb73ac
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   ffmpeg,
7   libglut,
8   glew,
9   glfw,
10   glm,
11   libGL,
12   libpulseaudio,
13   libX11,
14   libXau,
15   libXdmcp,
16   libXext,
17   libXpm,
18   libXrandr,
19   libXxf86vm,
20   lz4,
21   mpv,
22   pkg-config,
23   SDL2,
24   SDL2_mixer,
25   zlib,
26   fetchzip,
27   wayland,
28   wayland-protocols,
29   egl-wayland,
30   libffi,
31   wayland-scanner,
32   glib,
33   nss,
34   nspr,
35   atk,
36   at-spi2-atk,
37   libdrm,
38   expat,
39   libxcb,
40   libxkbcommon,
41   libXcomposite,
42   libXdamage,
43   libXfixes,
44   mesa,
45   gtk3,
46   pango,
47   cairo,
48   alsa-lib,
49   dbus,
50   at-spi2-core,
51   cups,
52   libxshmfence,
53   udev,
54   libdecor,
55   autoPatchelfHook,
56   makeWrapper,
58 let
59   rpath = lib.makeLibraryPath [
60     glib
61     nss
62     nspr
63     atk
64     at-spi2-atk
65     libdrm
66     libGL
67     expat
68     libxcb
69     libxkbcommon
70     libX11
71     libXcomposite
72     libXdamage
73     libXext
74     libXfixes
75     libXrandr
76     mesa
77     gtk3
78     pango
79     cairo
80     alsa-lib
81     dbus
82     at-spi2-core
83     cups
84     libxshmfence
85     udev
86   ];
87   buildType = "Release";
88   platform =
89     {
90       "aarch64-linux" = "linuxarm64";
91       "x86_64-linux" = "linux64";
92     }
93     .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
94   cef-bin-name = "cef_binary_120.1.10+g3ce3184+chromium-120.0.6099.129_${platform}";
95   cef-bin = stdenv.mkDerivation {
96     pname = "cef-bin";
97     version = "120.0.6099.129";
98     src =
99       let
100         hash =
101           {
102             "linuxarm64" = "sha256-iu8y2r1rd78fV2argulHoZJG+hPMPDKJ9ysnUyIgo5k=";
103             "linux64" = "sha256-FFkFMMkTSseLZIDzESFl8+h7wRhv5QGi1Uy5MViYpX8=";
104           }
105           .${platform};
106         urlName = builtins.replaceStrings [ "+" ] [ "%2B" ] cef-bin-name;
107       in
108       fetchzip {
109         url = "https://cef-builds.spotifycdn.com/${urlName}.tar.bz2";
110         inherit hash;
111       };
112     installPhase = ''
113       runHook preInstall
115       mkdir $out
116       cp -r ./* $out/
117       chmod +w -R $out/
118       patchelf $out/${buildType}/libcef.so --set-rpath "${rpath}" --add-needed libudev.so
119       patchelf $out/${buildType}/libGLESv2.so --set-rpath "${rpath}" --add-needed libGL.so.1
120       patchelf $out/${buildType}/chrome-sandbox --set-interpreter $(cat $NIX_BINTOOLS/nix-support/dynamic-linker)
121       sed 's/-O0/-O2/' -i $out/cmake/cef_variables.cmake
123       runHook postInstall
124     '';
125     meta = {
126       description = "Simple framework for embedding Chromium-based browsers in other applications";
127       homepage = "https://cef-builds.spotifycdn.com/index.html";
128       sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
129       license = lib.licenses.bsd3;
130       platforms = [
131         "x86_64-linux"
132         "aarch64-linux"
133       ];
134     };
135   };
136   buildInputs = [
137     libdecor
138     ffmpeg
139     libglut
140     glew
141     glfw
142     glm
143     libpulseaudio
144     libXau
145     SDL2_mixer
146     libXdmcp
147     libXpm
148     libXxf86vm
149     mpv
150     lz4
151     SDL2
152     zlib
153     wayland
154     wayland-protocols
155     egl-wayland
156     libffi
157     wayland-scanner
158     libXrandr
159   ];
161 stdenv.mkDerivation {
162   pname = "linux-wallpaperengine";
163   version = "0-unstable-2024-11-8";
165   src = fetchFromGitHub {
166     owner = "Almamu";
167     repo = "linux-wallpaperengine";
168     rev = "4a063d0b84d331a0086b3f4605358ee177328d41";
169     hash = "sha256-IRTGFxHPRRRSg0J07pq8fpo1XbMT4aZC+wMVimZlH/Y=";
170   };
172   nativeBuildInputs = [
173     cmake
174     pkg-config
175     autoPatchelfHook
176     makeWrapper
177   ];
179   inherit buildInputs;
181   cmakeFlags = [
182     "-DCMAKE_BUILD_TYPE=${buildType}"
183     "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/linux-wallpaperengine"
184   ];
186   postPatch = ''
187     patchShebangs .
188     mkdir -p third_party/cef/
189     ln -s ${cef-bin} third_party/cef/${cef-bin-name}
190   '';
192   preFixup = ''
193     patchelf --set-rpath "${lib.makeLibraryPath buildInputs}:${cef-bin}" $out/linux-wallpaperengine/linux-wallpaperengine
194     find $out -exec chmod 755 {} +
195     mkdir $out/bin
196     makeWrapper $out/linux-wallpaperengine/linux-wallpaperengine $out/bin/linux-wallpaperengine
197   '';
199   meta = {
200     description = "Wallpaper Engine backgrounds for Linux";
201     homepage = "https://github.com/Almamu/linux-wallpaperengine";
202     license = lib.licenses.gpl3Plus;
203     mainProgram = "linux-wallpaperengine";
204     maintainers = with lib.maintainers; [ aucub ];
205     platforms = [
206       "x86_64-linux"
207       "aarch64-linux"
208     ];
209   };