I’m trying to build Bolt, which uses Chromium Embedded Framework for its GUI. First, I just bundled a binary distribution of CEF as recommended in its readme:
let pkgs = import (builtins.fetchTarball ("channel:nixos-23.11")) { };
in with pkgs; {
default = let
pname = "bolt-launcher";
version = "0.8.2";
in stdenv.mkDerivation {
inherit pname version;
srcs = [
(fetchzip {
name = "cef";
url =
"https://cef-builds.spotifycdn.com/cef_binary_121.3.6%2Bgbbcaed4%2Bchromium-121.0.6167.139_linux64_minimal.tar.bz2";
hash = "sha256-aIc1/wduXsV2QCVmBtXIUsVARBy9lIHX4gbr1YhNgWM=";
})
(fetchFromGitHub {
name = pname;
owner = "Adamcake";
repo = "Bolt";
rev = version;
sha256 = "sha256-nUhySKA1VKDMzSqsaoTKt5vy91npWe2Ob0+F5zROxOg=";
fetchSubmodules = true;
})
];
sourceRoot = "bolt-launcher";
nativeBuildInputs = [ git cmake ninja gcc pkg-config ];
buildInputs = [ xorg.libX11 xorg.libxcb libarchive gtk3 openjdk17 ];
postUnpack = ''
ln -sfv ../../cef bolt-launcher/cef/dist
'';
cmakeFlags = [ "-DBOLT_SKIP_LIBRARIES=1" ];
};
}
This fails to link libcef.so
during buildPhase (e.g. ld: warning: libnss3.so, needed by /build/bolt-launcher/cef/dist/Release/libcef.so, not found
)
I tried setting env.LD_LIBRARY_PATH = "${lib.makeLibraryPath [ ... ]}"
, and this actually built, linked and installed fine. But running result/opt/bolt-launcher/bolt
gives “error while loading shared libraries.” I’m not sure how libcef.so can successfully be linked during the nix build and then throw this error afterwards?
I tried again with nixpkgs’s libcef
:
let pkgs = import (builtins.fetchTarball ("channel:nixos-23.11")) { };
in with pkgs; {
default = let
pname = "bolt-launcher";
version = "0.8.2";
in stdenv.mkDerivation {
inherit pname version;
srcs = [
(fetchzip {
name = "cef-bin";
url =
"https://cef-builds.spotifycdn.com/cef_binary_121.3.6%2Bgbbcaed4%2Bchromium-121.0.6167.139_linux64_minimal.tar.bz2";
hash = "sha256-aIc1/wduXsV2QCVmBtXIUsVARBy9lIHX4gbr1YhNgWM=";
})
(fetchFromGitHub {
name = pname;
owner = "Adamcake";
repo = "Bolt";
rev = version;
sha256 = "sha256-nUhySKA1VKDMzSqsaoTKt5vy91npWe2Ob0+F5zROxOg=";
fetchSubmodules = true;
})
];
sourceRoot = "bolt-launcher";
nativeBuildInputs = [ git cmake ninja gcc pkg-config ];
buildInputs =
[ xorg.libX11 xorg.libxcb libarchive gtk3 openjdk17 libcef pcre2 ];
cmakeFlags = [ "-DBOLT_SKIP_LIBRARIES=1" ];
postUnpack = ''
# Copied from the obs-linuxbrowser
mkdir -p cef/Release cef/Resources
for i in ${libcef}/share/cef/*; do
cp -r $i cef/Release/
cp -r $i cef/Resources/
done
cp -r ${libcef}/lib/libcef.so cef/Release/
cp -r ${libcef}/include cef/
cp -r cef-bin/cmake cef-bin/CMakeLists.txt cef-bin/libcef_dll cef/
chmod -R 777 cef/libcef_dll
cp -r ${libcef}/lib/libcef_dll_wrapper.a cef/libcef_dll/wrapper/
ln -sfv ../../cef bolt-launcher/cef/dist
'';
};
}
But this now causes a build error: /build/bolt-launcher/cef/dist/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc:101:50: error: 'class CefBrowserProcessHandler' has no member named 'OnAlreadyRunningAppRelaunch'
. I guess it makes sense that I can’t mix and match between versions of libcef that easily.
Does anyone have suggestions for how to package this successfully? Thanks!