Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions .nix/deps/cef.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
{ pkgs, inputs, ... }:

let
cef = pkgs.cef-binary.overrideAttrs {
cefPath = pkgs.cef-binary.overrideAttrs (finalAttrs: {
postInstall = ''
strip $out/Release/*.so*
'';
};

cefPath = pkgs.runCommand "cef-path" { } ''
mkdir -p $out
rm -r $out/* $out/.* || true
strip ./Release/*.so*
mv ./Release/* $out/
find "./Resources/locales" -maxdepth 1 -type f ! -name 'en-US.pak' -delete
mv ./Resources/* $out/
mv ./include $out/

ln -s ${cef}/include $out/include
find ${cef}/Release -name "*" -type f -exec ln -s {} $out/ \;
find ${cef}/Resources -name "*" -maxdepth 1 -exec ln -s {} $out/ \;

echo '${
builtins.toJSON {
type = "minimal";
name = builtins.baseNameOf cef.src.url;
sha1 = "";
}
}' > $out/archive.json
'';
echo '${
builtins.toJSON {
type = "minimal";
name = builtins.baseNameOf finalAttrs.src.url;
sha1 = "";
}
}' > $out/archive.json
'';
});
in
{
env.CEF_PATH = cefPath;
Expand Down
18 changes: 9 additions & 9 deletions .nix/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions .nix/pkgs/graphite-bundle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@ let
build = ''
mkdir -p out
mkdir -p out/bin
cp ${graphite}/bin/.graphite-wrapped out/bin/graphite
cp ${graphite}/bin/graphite out/bin/graphite
chmod -v +w out/bin/graphite
patchelf --set-rpath '$ORIGIN/../lib:$ORIGIN/../lib/cef' --set-interpreter '/lib64/ld-linux-x86-64.so.2' out/bin/graphite
patchelf \
--set-rpath '$ORIGIN/../lib:$ORIGIN/../lib/cef' \
--set-interpreter '/lib64/ld-linux-x86-64.so.2' \
--remove-needed libGL.so \
out/bin/graphite
cp -r ${graphite}/share out/share
mkdir -p out/lib/cef
mkdir -p ./cef
tar -xvf ${pkgs.cef-binary.src} -C ./cef --strip-components=1
cp -r ./cef/Release/* out/lib/cef/
cp -r ./cef/Resources/* out/lib/cef/
find "out/lib/cef/locales" -type f ! -name 'en-US*' -delete
${pkgs.bintools}/bin/strip out/lib/cef/*.so*
cp -r ${graphite}/share out/share
'';
install =
if tar then
Expand Down
22 changes: 16 additions & 6 deletions .nix/pkgs/graphite.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ let
mkdir -p $out
tar -xvf ${brandingTar} -C $out --strip-components 1
'';
cargoVendorDir = deps.crane.lib.vendorCargoDeps { inherit (info) src; };
resourcesCommon = {
pname = "${info.pname}-resources";
inherit (info) version src;
inherit cargoVendorDir;
strictDeps = true;
doCheck = false;
nativeBuildInputs = tools.frontend;
env.CARGO_PROFILE = if dev then "dev" else "release";
cargoExtraArgs = "--target wasm32-unknown-unknown -p graphite-wasm --no-default-features --features native";
doCheck = false;
};
resources = deps.crane.lib.buildPackage (
resourcesCommon
Expand All @@ -52,7 +54,7 @@ let
npmConfigScript = "setup";
makeCacheWritable = true;

nativeBuildInputs = tools.frontend ++ [ pkgs.importNpmLock.npmConfigHook ];
nativeBuildInputs = tools.frontend ++ [ pkgs.importNpmLock.npmConfigHook pkgs.removeReferencesTo ];

prePatch = ''
mkdir branding
Expand All @@ -72,13 +74,18 @@ let
mkdir -p $out
cp -r frontend/dist/* $out/
'';

postFixup = ''
find "$out" -type f -exec remove-references-to -t "${cargoVendorDir}" '{}' +
'';
}
);
common = {
inherit (info) pname version src;
inherit cargoVendorDir;
strictDeps = true;
buildInputs = libs.desktop-all;
nativeBuildInputs = tools.desktop ++ [ pkgs.makeWrapper ];
nativeBuildInputs = tools.desktop ++ [ pkgs.makeWrapper pkgs.removeReferencesTo ];
env = deps.cef.env // {
CARGO_PROFILE = if dev then "dev" else "release";
};
Expand Down Expand Up @@ -138,9 +145,12 @@ deps.crane.lib.buildPackage (
'';

postFixup = ''
wrapProgram "$out/bin/graphite" \
--prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath libs.desktop-all}:${deps.cef.env.CEF_PATH}" \
--set CEF_PATH "${deps.cef.env.CEF_PATH}"
remove-references-to -t "${cargoVendorDir}" $out/bin/graphite

patchelf \
--set-rpath "${pkgs.lib.makeLibraryPath libs.desktop-all}:${deps.cef.env.CEF_PATH}" \
--add-needed libGL.so \
$out/bin/graphite
'';
}
)
Loading