From 025bfef13bb1eeb22b968185f230acb305e1a81d Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Sat, 14 Dec 2024 23:11:13 +0800 Subject: [PATCH 1/2] linux-wallpaperengine: refactor --- .../li/linux-wallpaperengine/package.nix | 94 +++++++++---------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/pkgs/by-name/li/linux-wallpaperengine/package.nix b/pkgs/by-name/li/linux-wallpaperengine/package.nix index 4edd2db455e1..af38e7a01f8f 100644 --- a/pkgs/by-name/li/linux-wallpaperengine/package.nix +++ b/pkgs/by-name/li/linux-wallpaperengine/package.nix @@ -87,36 +87,33 @@ let systemd ]; buildType = "Release"; - platform = - { - "aarch64-linux" = "linuxarm64"; - "x86_64-linux" = "linux64"; - } - .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); - cef-bin-name = "cef_binary_120.1.10+g3ce3184+chromium-120.0.6099.129_${platform}"; + selectSystem = + attrs: + attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); + arch = selectSystem { + aarch64-linux = "arm64"; + x86_64-linux = "x64"; + }; + cef-bin-name = "cef_binary_120.1.10+g3ce3184+chromium-120.0.6099.129_linux${arch}"; cef-bin = stdenv.mkDerivation { pname = "cef-bin"; version = "120.0.6099.129"; - src = - let - hash = - { - "linuxarm64" = "sha256-2mOh3GWdx0qxsLRKVYXOJnVY0eqz6B3z9/B9A9Xfs/A="; - "linux64" = "sha256-FFkFMMkTSseLZIDzESFl8+h7wRhv5QGi1Uy5MViYpX8="; - } - .${platform}; - urlName = builtins.replaceStrings [ "+" ] [ "%2B" ] cef-bin-name; - in - fetchzip { - url = "https://cef-builds.spotifycdn.com/${urlName}.tar.bz2"; - inherit hash; + + src = fetchzip { + url = "https://cef-builds.spotifycdn.com/${ + builtins.replaceStrings [ "+" ] [ "%2B" ] cef-bin-name + }.tar.bz2"; + hash = selectSystem { + aarch64-linux = "sha256-2mOh3GWdx0qxsLRKVYXOJnVY0eqz6B3z9/B9A9Xfs/A="; + x86_64-linux = "sha256-FFkFMMkTSseLZIDzESFl8+h7wRhv5QGi1Uy5MViYpX8="; }; + }; + installPhase = '' runHook preInstall - mkdir $out - cp -r ./* $out/ - chmod +w -R $out/ + cp -r . $out + chmod +w -R $out patchelf $out/${buildType}/libcef.so --set-rpath "${rpath}" --add-needed libudev.so patchelf $out/${buildType}/libGLESv2.so --set-rpath "${rpath}" --add-needed libGL.so.1 patchelf $out/${buildType}/chrome-sandbox --set-interpreter $(cat $NIX_BINTOOLS/nix-support/dynamic-linker) @@ -124,6 +121,7 @@ let runHook postInstall ''; + meta = { description = "Simple framework for embedding Chromium-based browsers in other applications"; homepage = "https://cef-builds.spotifycdn.com/index.html"; @@ -135,6 +133,25 @@ let ]; }; }; +in +stdenv.mkDerivation rec { + pname = "linux-wallpaperengine"; + version = "0-unstable-2024-11-08"; + + src = fetchFromGitHub { + owner = "Almamu"; + repo = "linux-wallpaperengine"; + rev = "4a063d0b84d331a0086b3f4605358ee177328d41"; + hash = "sha256-IRTGFxHPRRRSg0J07pq8fpo1XbMT4aZC+wMVimZlH/Y="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + autoPatchelfHook + makeWrapper + ]; + buildInputs = [ libdecor ffmpeg @@ -159,41 +176,16 @@ let wayland-scanner libXrandr ]; -in -stdenv.mkDerivation { - pname = "linux-wallpaperengine"; - version = "0-unstable-2024-11-8"; - - src = fetchFromGitHub { - owner = "Almamu"; - repo = "linux-wallpaperengine"; - rev = "4a063d0b84d331a0086b3f4605358ee177328d41"; - hash = "sha256-IRTGFxHPRRRSg0J07pq8fpo1XbMT4aZC+wMVimZlH/Y="; - }; - - nativeBuildInputs = [ - cmake - pkg-config - autoPatchelfHook - makeWrapper - ]; - - inherit buildInputs; cmakeFlags = [ "-DCMAKE_BUILD_TYPE=${buildType}" + "-DCEF_ROOT=${cef-bin}" "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/linux-wallpaperengine" ]; - postPatch = '' - patchShebangs . - mkdir -p third_party/cef/ - ln -s ${cef-bin} third_party/cef/${cef-bin-name} - ''; - preFixup = '' patchelf --set-rpath "${lib.makeLibraryPath buildInputs}:${cef-bin}" $out/linux-wallpaperengine/linux-wallpaperengine - find $out -exec chmod 755 {} + + chmod 755 $out/linux-wallpaperengine/linux-wallpaperengine mkdir $out/bin makeWrapper $out/linux-wallpaperengine/linux-wallpaperengine $out/bin/linux-wallpaperengine ''; @@ -201,7 +193,7 @@ stdenv.mkDerivation { meta = { description = "Wallpaper Engine backgrounds for Linux"; homepage = "https://github.com/Almamu/linux-wallpaperengine"; - license = lib.licenses.gpl3Plus; + license = with lib.licenses; [ gpl3Plus ]; mainProgram = "linux-wallpaperengine"; maintainers = with lib.maintainers; [ aucub ]; platforms = [ From 746c82624413a2c5acab625847d78d0e054e4314 Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Sat, 14 Dec 2024 23:11:20 +0800 Subject: [PATCH 2/2] aliases: remove linux_wallpaperengine --- pkgs/top-level/aliases.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index b54542048572..a0724786e2bb 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -676,7 +676,6 @@ mapAliases { lightdm_gtk_greeter = lightdm-gtk-greeter; # Added 2022-08-01 lightstep-tracer-cpp = throw "lightstep-tracer-cpp is deprecated since 2022-08-29; the upstream recommends migration to opentelemetry projects."; limesctl = throw "limesctl has been removed because it is insignificant."; # Added 2024-11-25 - linux_wallpaperengine = throw "linux_wallpaperengine was removed due to freeimage dependency"; # Added 2024-07-19 lispPackages_new = throw "Lisp packages have been redesigned. See 'lisp-modules' in the nixpkgs manual."; # Added 2024-05-07 lispPackages = throw "Lisp packages have been redesigned. See 'lisp-modules' in the nixpkgs manual."; # Added 2024-05-07 lispPackagesFor = throw "Lisp packages have been redesigned. See 'lisp-modules' in the nixpkgs manual."; # Added 2024-05-07