Skip to content

Instantly share code, notes, and snippets.

@reinismu
Created July 3, 2024 12:29
Show Gist options
  • Save reinismu/31452372283a7b89715399bd7e763aad to your computer and use it in GitHub Desktop.
Save reinismu/31452372283a7b89715399bd7e763aad to your computer and use it in GitHub Desktop.
{
autoPatchelfHook,
fetchFromGitHub,
fetchzip,
cmake,
lib,
makeWrapper,
patchelf,
pkg-config,
stdenv,
pkgs,
glib,
zlib,
darwin
}:
let
version = "0.1.0";
fileName = "cef_binary_122.1.13+gde5b724+chromium-122.0.6261.130_macosarm64";
urlName = builtins.replaceStrings ["+"] ["%2B"] fileName;
cefBin = fetchzip {
url = "https://cef-builds.spotifycdn.com/${urlName}.tar.bz2";
hash = "sha256-jrGMun6yEN3kGDbcoxKFlV4Eoz1NGE77fK9gW+cXsVM=";
};
rpath = lib.makeLibraryPath [
glib
];
in
stdenv.mkDerivation {
pname = "gstcefsrc";
inherit version;
src = fetchFromGitHub {
owner = "SteveMcFarlin";
repo = "gstcefsrc";
rev = "d61bb9153f46718187830011b2f1fec6f2c9d267";
hash = "sha256-ZP+UQf74X3tVzX5giJ+A9HxojWw2cuZ1cV6Y/3LTHbE=";
};
buildInputs = [
pkgs.gst_all_1.gstreamer
pkgs.gst_all_1.gst-plugins-base
darwin.apple_sdk.frameworks.Cocoa
];
nativeBuildInputs = [
cmake
makeWrapper
pkg-config
];
configurePhase = ''
runHook preConfigure
mkdir --parents build
mkdir --parents third_party/cef/${fileName}
cp -r ${cefBin}/* third_party/cef/${fileName}
chmod +w -R third_party/cef/${fileName}
(
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
)
runHook postConfigure
'';
buildPhase = ''
cd build
make -j $NIX_BUILD_CORES
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir --parents "$out"
cp --archive --verbose --target-directory="$out" Release/*
runHook postInstall
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment