package.nix 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 = "156.0.14+g4fa4ab5+chromium-156.0.8078.48";
  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-QZGskgqRoFLroEr7btgw1HrtRqPiRsQ0ovBiwjWI3Io=";
  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. nss
  134. nspr
  135. cups
  136. at-spi2-atk
  137. at-spi2-core
  138. atk
  139. libdrm
  140. mesa
  141. libgbm
  142. systemdLibs
  143. alsa-lib
  144. pango
  145. cairo
  146. glib
  147. expat
  148. ]
  149. ++ (with xorg; [
  150. libX11
  151. libXrandr
  152. libXinerama
  153. libXcursor
  154. libXi
  155. libXxf86vm
  156. libXcomposite
  157. libXdamage
  158. libXext
  159. libXfixes
  160. libxshmfence
  161. libxcb
  162. ]);
  163. # loaded at runtime with dlopen (GL dispatch, Vulkan for CEF, VA-API, the audio backends SDL picks)
  164. runtimeDependencies = map lib.getLib [
  165. libglvnd
  166. vulkan-loader
  167. libva
  168. libpulseaudio
  169. pipewire
  170. alsa-lib
  171. wayland
  172. libxkbcommon
  173. ];
  174. cmakeFlags = [
  175. (lib.cmakeBool "DISABLE_KDE_FEATURES" disableKdeFeatures)
  176. (lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release")
  177. (lib.cmakeFeature "V8_INCLUDE_DIR" "${libnode}/include/node")
  178. # relative, package_release.sh installs into a prefix of its own
  179. (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
  180. (lib.cmakeFeature "CMAKE_EXE_LINKER_FLAGS" "-Wl,-rpath-link,${cefLibraries}")
  181. ];
  182. # the CEF wrapper library builds with -Werror and defines its own _FORTIFY_SOURCE
  183. hardeningDisable = [ "fortify" "fortify3" ];
  184. preConfigure = ''
  185. # node installs only the versioned libnode.so.<abi>
  186. cmakeFlagsArray+=("-DV8_LIBRARY=$(echo ${libnode}/lib/libnode.so.*)")
  187. mkdir -p build/cef
  188. ln -s ${cef} build/cef/${cefArchive}
  189. '';
  190. # the same file set as the release tarballs, the install tree also carries the vendored libraries' tools
  191. installPhase = ''
  192. runHook preInstall
  193. bash ../tools/package_release.sh . linux-wallpaperengine-kde "$TMPDIR/dist"
  194. mkdir -p $out/opt $out/bin
  195. tar -xzf "$TMPDIR/dist/linux-wallpaperengine-kde.tar.gz" -C $out/opt
  196. ln -s $out/opt/linux-wallpaperengine-kde/linux-wallpaperengine $out/bin/linux-wallpaperengine
  197. cp -r $out/opt/linux-wallpaperengine-kde/share $out/share
  198. runHook postInstall
  199. '';
  200. dontStrip = true;
  201. meta = {
  202. description = "Wallpaper Engine live wallpapers on Linux, fork of linux-wallpaperengine (started with KDE, now supports most desktops)";
  203. homepage = "https://github.com/WallpaperEngineLover/linux-wallpaperengine-kde";
  204. license = lib.licenses.gpl3Only;
  205. platforms = [ "x86_64-linux" ];
  206. mainProgram = "linux-wallpaperengine";
  207. };
  208. }