package.nix 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. libdrm,
  39. mesa,
  40. alsa-lib,
  41. pango,
  42. cairo,
  43. glib,
  44. expat,
  45. libva,
  46. vulkan-loader,
  47. pipewire,
  48. src,
  49. version,
  50. disableKdeFeatures ? false,
  51. }:
  52. let
  53. # V8 comes from Node.js's shared library like on the distributions (Arch's AUR libnode is the same build).
  54. # nixpkgs only has a static libv8, whose local-exec TLS can't go into our shared library
  55. libnode = nodejs-slim_24.overrideAttrs (old: {
  56. pname = "libnode";
  57. configureFlags = (old.configureFlags or [ ]) ++ [ "--shared" ];
  58. doCheck = false;
  59. doInstallCheck = false;
  60. });
  61. # the version CMakeLists.txt pins, CMake's DownloadCEF finds the archive already in its folder
  62. cefVersion = "135.0.17+gcbc1c5b+chromium-135.0.7049.52";
  63. cefArchive = "cef_binary_${cefVersion}_linux64_minimal.tar.bz2";
  64. cef = fetchurl {
  65. url = "https://cef-builds.spotifycdn.com/${lib.replaceStrings [ "+" ] [ "%2B" ] cefArchive}";
  66. hash = "sha256-JKwZgOYr57GuosM31r1Lx3DczYs35HxtuUs5fxPsTcY=";
  67. };
  68. in
  69. stdenv.mkDerivation {
  70. pname = "linux-wallpaperengine-kde";
  71. inherit version src;
  72. nativeBuildInputs = [
  73. cmake
  74. pkg-config
  75. python3
  76. autoPatchelfHook
  77. wayland-scanner
  78. binutils
  79. ];
  80. buildInputs = [
  81. glm
  82. glfw
  83. glew
  84. freeglut
  85. libGLU
  86. libGL
  87. SDL2
  88. lz4
  89. zlib
  90. ffmpeg
  91. mpv-unwrapped
  92. libpulseaudio
  93. freetype
  94. harfbuzz
  95. dbus
  96. wayland
  97. wayland-protocols
  98. libxkbcommon
  99. gmp
  100. libnode
  101. # CEF's own libraries
  102. nss
  103. nspr
  104. cups
  105. at-spi2-atk
  106. at-spi2-core
  107. libdrm
  108. mesa
  109. alsa-lib
  110. pango
  111. cairo
  112. glib
  113. expat
  114. ]
  115. ++ (with xorg; [
  116. libX11
  117. libXrandr
  118. libXinerama
  119. libXcursor
  120. libXi
  121. libXxf86vm
  122. libXcomposite
  123. libXdamage
  124. libXext
  125. libXfixes
  126. libxshmfence
  127. libxcb
  128. ]);
  129. # loaded at runtime with dlopen (GL dispatch, Vulkan for CEF, VA-API, the audio backends SDL picks)
  130. runtimeDependencies = map lib.getLib [
  131. libglvnd
  132. vulkan-loader
  133. libva
  134. libpulseaudio
  135. pipewire
  136. alsa-lib
  137. wayland
  138. libxkbcommon
  139. ];
  140. cmakeFlags = [
  141. (lib.cmakeBool "DISABLE_KDE_FEATURES" disableKdeFeatures)
  142. (lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release")
  143. (lib.cmakeFeature "V8_INCLUDE_DIR" "${libnode}/include/node")
  144. # relative, package_release.sh installs into a prefix of its own
  145. (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
  146. ];
  147. # the CEF wrapper library builds with -Werror and defines its own _FORTIFY_SOURCE
  148. hardeningDisable = [ "fortify" "fortify3" ];
  149. preConfigure = ''
  150. # node installs only the versioned libnode.so.<abi>
  151. cmakeFlagsArray+=("-DV8_LIBRARY=$(echo ${libnode}/lib/libnode.so.*)")
  152. mkdir -p build/cef
  153. ln -s ${cef} build/cef/${cefArchive}
  154. '';
  155. # the same file set as the release tarballs, the install tree also carries the vendored libraries' tools
  156. installPhase = ''
  157. runHook preInstall
  158. bash ../tools/package_release.sh . linux-wallpaperengine-kde "$TMPDIR/dist"
  159. mkdir -p $out/opt $out/bin
  160. tar -xzf "$TMPDIR/dist/linux-wallpaperengine-kde.tar.gz" -C $out/opt
  161. ln -s $out/opt/linux-wallpaperengine-kde/linux-wallpaperengine $out/bin/linux-wallpaperengine
  162. runHook postInstall
  163. '';
  164. dontStrip = true;
  165. meta = {
  166. description = "Wallpaper Engine live wallpapers on Linux, KDE/Wayland fork of linux-wallpaperengine";
  167. homepage = "https://github.com/WallpaperEngineLover/linux-wallpaperengine-kde";
  168. license = lib.licenses.gpl3Only;
  169. platforms = [ "x86_64-linux" ];
  170. mainProgram = "linux-wallpaperengine";
  171. };
  172. }