From 5b353828ff1c548fac9e11ac2c8f40cab3e4f409 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Wed, 14 Feb 2024 10:50:19 +0100 Subject: [PATCH] Add servo --- nixos/desktop/default.nix | 1 + pkgs/default.nix | 1 + pkgs/servo/default.nix | 79 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 pkgs/servo/default.nix diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index ddd08a1..23cc32c 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -63,6 +63,7 @@ # Custom tools dvd dvt + servo # System tools direnv diff --git a/pkgs/default.nix b/pkgs/default.nix index 819fb05..998cdfa 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -3,4 +3,5 @@ pkgs: { dvd = pkgs.callPackage ./dvd {}; dvt = pkgs.callPackage ./dvt {}; + servo = pkgs.callPackage ./servo {}; } diff --git a/pkgs/servo/default.nix b/pkgs/servo/default.nix new file mode 100644 index 0000000..3c948fc --- /dev/null +++ b/pkgs/servo/default.nix @@ -0,0 +1,79 @@ +{ + lib, + stdenv, + fetchurl, + autoPatchelfHook, + zlib, + glib, + harfbuzz, + fontconfig, + freetype, + dbus, + libunwind, + gst_all_1, + xorg, + libxkbcommon, + vulkan-loader, +}: +stdenv.mkDerivation rec { + pname = "servo"; + version = "2024-01-05"; + + src = fetchurl { + url = "https://github.com/servo/servo-nightly-builds/releases/download/${version}/servo-latest.tar.gz"; + hash = "sha256-IlmoYIFk0QO0CieJ49m8PnEou1Q3w+Tk9rypI0ya2WQ="; + }; + + nativeBuildInputs = [ + autoPatchelfHook + ]; + + buildInputs = + [ + stdenv.cc.cc.lib + zlib + glib + harfbuzz + fontconfig + freetype + dbus + libunwind + ] + ++ (with gst_all_1; [ + gstreamer + gst-plugins-base + gst-plugins-bad + ]) + ++ (with xorg; [ + libxcb + libX11 + ]); + + runtimeDependencies = + [ + libxkbcommon + vulkan-loader + ] + ++ (with xorg; [ + libXcursor + libXrandr + libXi + ]); + + sourceRoot = "servo"; + + installPhase = '' + runHook preInstall + install -m755 -D servo $out/bin/._servo + echo "WINIT_UNIX_BACKEND=x11 $out/bin/._servo" > $out/bin/servo + chmod +x $out/bin/servo + cp -r ./resources $out/bin/ + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://servo.org"; + description = "The embeddable, independent, memory-safe, modular, parallel web rendering engine"; + platforms = platforms.linux; + }; +}