Skip to content

Commit e0d3c21

Browse files
Update CEF
1 parent 96b18d2 commit e0d3c21

16 files changed

Lines changed: 290 additions & 185 deletions

File tree

.nix/default.nix

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ let
3131

3232
deps = {
3333
crane = lib.call ./deps/crane.nix;
34-
cef = lib.call ./deps/cef.nix;
3534
rustGPU = lib.call ./deps/rust-gpu.nix;
3635
};
3736

@@ -62,13 +61,13 @@ in
6261
graphite-bundle = (lib.call ./pkgs/graphite-bundle.nix) { };
6362
graphite-bundle-dev = (lib.call ./pkgs/graphite-bundle.nix) { graphite = graphite-dev; };
6463
graphite-flatpak-manifest = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { };
65-
graphite-flatpak-manifest-dev = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { graphite-bundle = graphite-bundle-dev; };
64+
graphite-flatpak-manifest-dev = (lib.call ./pkgs/graphite-flatpak-manifest.nix) {
65+
graphite-bundle = graphite-bundle-dev;
66+
};
6667

6768
# TODO: graphene-cli = lib.call ./pkgs/graphene-cli.nix;
6869

69-
tools = {
70-
third-party-licenses = lib.call ./pkgs/tools/third-party-licenses.nix;
71-
};
70+
graphite-cef = lib.call ./pkgs/graphite-cef/package.nix;
7271
}
7372
);
7473

.nix/deps/cef.nix

Lines changed: 0 additions & 27 deletions
This file was deleted.

.nix/dev.nix

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
{ pkgs, deps, ... }:
1+
{
2+
pkgs,
3+
deps,
4+
self,
5+
system,
6+
...
7+
}:
28

39
let
410
libs = [
@@ -51,13 +57,13 @@ pkgs.mkShell (
5157
pkgs.graphviz
5258
];
5359

54-
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs}:${deps.cef.env.CEF_PATH}";
60+
CEF_PATH = self.packages.${system}.graphite-cef;
61+
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs}:${self.packages.${system}.graphite-cef}";
5562
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
5663

57-
# shellHook = ''
58-
# alias cargo='mold --run cargo'
59-
# '';
64+
# shellHook = ''
65+
# alias cargo='mold --run cargo'
66+
# '';
6067
}
61-
// deps.cef.env
6268
// deps.rustGPU.env
6369
)

.nix/pkgs/graphite-bundle.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
pkgs,
3+
deps,
34
self,
45
system,
56
...
@@ -33,7 +34,7 @@ let
3334
cp -r ${graphite}/share out/share
3435
mkdir -p out/lib/cef
3536
mkdir -p ./cef
36-
tar -xvf ${pkgs.cef-binary.src} -C ./cef --strip-components=1
37+
tar -xvf ${self.packages.${system}.graphite-cef.src} -C ./cef --strip-components=1
3738
cp -r ./cef/Release/* out/lib/cef/
3839
cp -r ./cef/Resources/* out/lib/cef/
3940
find "out/lib/cef/locales" -type f ! -name 'en-US*' -delete

.nix/pkgs/graphite-cef/package.nix

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{ pkgs, ... }:
2+
3+
let
4+
versionFile = builtins.fromJSON (builtins.readFile ./version.json);
5+
6+
version = versionFile.version;
7+
hash = selectSystem versionFile.hashes;
8+
9+
selectSystem =
10+
attrs:
11+
attrs.${pkgs.stdenv.hostPlatform.system}
12+
or (throw "Unsupported system ${pkgs.stdenv.hostPlatform.system}");
13+
14+
src = pkgs.fetchurl {
15+
url = "https://cef-builds.spotifycdn.com/cef_binary_${version}_${
16+
selectSystem {
17+
aarch64-linux = "linuxarm64";
18+
x86_64-linux = "linux64";
19+
}
20+
}_minimal.tar.bz2";
21+
hash = hash;
22+
};
23+
in
24+
pkgs.cef-binary.overrideAttrs (finalAttrs: {
25+
version = builtins.head (builtins.split "\\+" version);
26+
inherit src;
27+
postInstall = ''
28+
rm -r $out/* $out/.* || true
29+
strip ./Release/*.so*
30+
mv ./Release/* $out/
31+
find "./Resources/locales" -maxdepth 1 -type f ! -name 'en-US.pak' -delete
32+
mv ./Resources/* $out/
33+
mv ./include $out/
34+
35+
cat ./CREDITS.html | ${pkgs.xz}/bin/xz -9 -e -c > $out/CREDITS.html.xz
36+
37+
echo '${
38+
builtins.toJSON {
39+
type = "minimal";
40+
name = builtins.baseNameOf finalAttrs.src.url;
41+
sha1 = "";
42+
}
43+
}' > $out/archive.json
44+
'';
45+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"version": "146.0.12+g6214c8e+chromium-146.0.7680.179",
3+
"hashes": {
4+
"aarch64-linux": "sha256-pi3fV3O31YMHcOh+/lnk2gWI6/MaSNAiUgFhD09d7u0=",
5+
"x86_64-linux": "sha256-b2HKaSEEXkZsnsBw9bL2JGmKWwRN5l2wu/O1DxfhAgE="
6+
}
7+
}

.nix/pkgs/graphite.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let
5050
pkgs.pkg-config
5151
pkgs.lld
5252
];
53-
env = deps.cef.env;
53+
env.CEF_PATH = self.packages.${system}.graphite-cef;
5454
buildPhase =
5555
let
5656
profile = if dev then "dev" else "release";
@@ -97,10 +97,11 @@ deps.crane.lib.buildPackage (
9797
npmConfigScript = "setup";
9898
makeCacheWritable = true;
9999

100-
env = deps.cef.env // {
100+
env = {
101101
RASTER_NODES_SHADER_PATH = self.packages.${system}.graphite-raster-nodes-shaders;
102102
GRAPHITE_GIT_COMMIT_HASH = self.rev or "unknown";
103103
GRAPHITE_GIT_COMMIT_DATE = self.lastModified or "unknown";
104+
CEF_PATH = self.packages.${system}.graphite-cef;
104105
};
105106

106107
postPatch = ''
@@ -149,7 +150,7 @@ deps.crane.lib.buildPackage (
149150
remove-references-to -t "${common.cargoVendorDir}" $out/bin/graphite
150151
151152
patchelf \
152-
--set-rpath "${pkgs.lib.makeLibraryPath libs}:${deps.cef.env.CEF_PATH}" \
153+
--set-rpath "${pkgs.lib.makeLibraryPath libs}:${self.packages.${system}.graphite-cef}" \
153154
--add-needed libGL.so \
154155
$out/bin/graphite
155156
'';

.nix/pkgs/tools/third-party-licenses.nix

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)