package.nix 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. {
  2. lib,
  3. stdenv,
  4. fetchurl,
  5. cmake,
  6. pkg-config,
  7. python3,
  8. autoPatchelfHook,
  9. wayland-scanner,
  10. binutils,
  11. glm,
  12. glfw,
  13. glew,
  14. freeglut,
  15. libGLU,
  16. libGL,
  17. libglvnd,
  18. SDL2,
  19. lz4,
  20. zlib,
  21. ffmpeg,
  22. mpv-unwrapped,
  23. libpulseaudio,
  24. freetype,
  25. harfbuzz,
  26. dbus,
  27. wayland,
  28. wayland-protocols,
  29. libxkbcommon,
  30. xorg,
  31. gmp,
  32. nodejs-slim_24,
  33. nss,
  34. nspr,
  35. cups,
  36. at-spi2-atk,
  37. at-spi2-core,
  38. atk,
  39. libdrm,
  40. mesa,
  41. libgbm,
  42. systemdLibs,
  43. alsa-lib,
  44. pango,
  45. cairo,
  46. glib,
  47. expat,
  48. libva,
  49. vulkan-loader,
  50. pipewire,
  51. src,
  52. version,
  53. disableKdeFeatures ? false,
  54. }:
  55. let
  56. # V8 comes from Node.js's shared library like on the distributions (Arch's AUR libnode is the same build).
  57. # nixpkgs only has a static libv8, whose local-exec TLS can't go into our shared library
  58. libnode = nodejs-slim_24.overrideAttrs (old: {
  59. pname = "libnode";
  60. configureFlags = (old.configureFlags or [ ]) ++ [ "--shared" ];
  61. doCheck = false;
  62. doInstallCheck = false;
  63. });
  64. # the web helper links nothing but libcef.so, and ld finds the libraries libcef.so needs only through -rpath-link
  65. cefLibraries = lib.makeLibraryPath (
  66. [
  67. glib
  68. nss
  69. nspr
  70. dbus
  71. atk
  72. at-spi2-atk
  73. at-spi2-core
  74. cups
  75. libgbm
  76. expat
  77. libxkbcommon
  78. pango
  79. cairo
  80. alsa-lib
  81. systemdLibs
  82. ]
  83. ++ (with xorg; [
  84. libX11
  85. libXcomposite
  86. libXdamage
  87. libXext
  88. libXfixes
  89. libXrandr
  90. libxcb
  91. ])
  92. );
  93. # the version CMakeLists.txt pins, CMake's DownloadCEF finds the archive already in its folder
  94. cefVersion = "135.0.17+gcbc1c5b+chromium-135.0.7049.52";
  95. cefArchive = "cef_binary_${cefVersion}_linux64_minimal.tar.bz2";
  96. cef = fetchurl {
  97. url = "https://cef-builds.spotifycdn.com/${lib.replaceStrings [ "+" ] [ "%2B" ] cefArchive}";
  98. hash = "sha256-JKwZgOYr57GuosM31r1Lx3DczYs35HxtuUs5fxPsTcY=";
  99. };
  100. in
  101. stdenv.mkDerivation {
  102. pname = "linux-wallpaperengine-kde";
  103. inherit version src;
  104. nativeBuildInputs = [
  105. cmake
  106. pkg-config
  107. python3
  108. autoPatchelfHook
  109. wayland-scanner
  110. binutils
  111. ];
  112. buildInputs = [
  113. glm
  114. glfw
  115. glew
  116. freeglut
  117. libGLU
  118. libGL
  119. SDL2
  120. lz4
  121. zlib
  122. ffmpeg
  123. mpv-unwrapped
  124. libpulseaudio
  125. freetype
  126. harfbuzz
  127. dbus
  128. wayland
  129. wayland-protocols
  130. libxkbcommon
  131. gmp
  132. libnode
  133. # CEF's own libraries
  134. nss
  135. nspr
  136. cups
  137. at-spi2-atk
  138. at-spi2-core
  139. atk
  140. libdrm
  141. mesa
  142. libgbm
  143. systemdLibs
  144. alsa-lib
  145. pango
  146. cairo
  147. glib
  148. expat
  149. ]
  150. ++ (with xorg; [
  151. libX11
  152. libXrandr
  153. libXinerama
  154. libXcursor
  155. libXi
  156. libXxf86vm
  157. libXcomposite
  158. libXdamage
  159. libXext
  160. libXfixes
  161. libxshmfence
  162. libxcb
  163. ]);
  164. # loaded at runtime with dlopen (GL dispatch, Vulkan for CEF, VA-API, the audio backends SDL picks)
  165. runtimeDependencies = map lib.getLib [
  166. libglvnd
  167. vulkan-loader
  168. libva
  169. libpulseaudio
  170. pipewire
  171. alsa-lib
  172. wayland
  173. libxkbcommon
  174. ];
  175. cmakeFlags = [
  176. (lib.cmakeBool "DISABLE_KDE_FEATURES" disableKdeFeatures)
  177. (lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release")
  178. (lib.cmakeFeature "V8_INCLUDE_DIR" "${libnode}/include/node")
  179. # relative, package_release.sh installs into a prefix of its own
  180. (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
  181. (lib.cmakeFeature "CMAKE_EXE_LINKER_FLAGS" "-Wl,-rpath-link,${cefLibraries}")
  182. ];
  183. # the CEF wrapper library builds with -Werror and defines its own _FORTIFY_SOURCE
  184. hardeningDisable = [ "fortify" "fortify3" ];
  185. preConfigure = ''
  186. # node installs only the versioned libnode.so.<abi>
  187. cmakeFlagsArray+=("-DV8_LIBRARY=$(echo ${libnode}/lib/libnode.so.*)")
  188. mkdir -p build/cef
  189. ln -s ${cef} build/cef/${cefArchive}
  190. '';
  191. # the same file set as the release tarballs, the install tree also carries the vendored libraries' tools
  192. installPhase = ''
  193. runHook preInstall
  194. bash ../tools/package_release.sh . linux-wallpaperengine-kde "$TMPDIR/dist"
  195. mkdir -p $out/opt $out/bin
  196. tar -xzf "$TMPDIR/dist/linux-wallpaperengine-kde.tar.gz" -C $out/opt
  197. ln -s $out/opt/linux-wallpaperengine-kde/linux-wallpaperengine $out/bin/linux-wallpaperengine
  198. cp -r $out/opt/linux-wallpaperengine-kde/share $out/share
  199. runHook postInstall
  200. '';
  201. dontStrip = true;
  202. meta = {
  203. description = "Wallpaper Engine live wallpapers on Linux, fork of linux-wallpaperengine (started with KDE, now supports most desktops)";
  204. homepage = "https://github.com/WallpaperEngineLover/linux-wallpaperengine-kde";
  205. license = lib.licenses.gpl3Only;
  206. platforms = [ "x86_64-linux" ];
  207. mainProgram = "linux-wallpaperengine";
  208. };
  209. }