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
28 changes: 28 additions & 0 deletions .github/workflows/build-linux-bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Linux Bundle

on:
workflow_dispatch: {}
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Free disk space
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache

- name: Build Linux Bundle
run: nix build .nix#graphite-bundle.tar.xz && cp ./result ./graphite-bundle.tar.xz

- name: Upload Linux Bundle
uses: actions/upload-artifact@v4
with:
path: graphite-bundle.tar.xz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
branding/
target/
result/
.flatpak-builder/
*.spv
*.exrc
perf.data*
Expand Down
18 changes: 10 additions & 8 deletions .nix/deps/cef.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
{ pkgs, inputs, ... }:

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

cefPath = pkgs.runCommand "cef-path" {} ''
cefPath = pkgs.runCommand "cef-path" { } ''
mkdir -p $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 cef.src.url;
sha1 = "";
}
}' > $out/archive.json
'';
in
{
Expand Down
12 changes: 11 additions & 1 deletion .nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
info = {
pname = "graphite";
version = "unstable";
src = ./..;
src = pkgs.lib.cleanSourceWith {
src = ./..;
filter = path: type: !(type == "directory" && builtins.baseNameOf path == ".nix");
};
};

pkgs = import inputs.nixpkgs {
Expand Down Expand Up @@ -129,6 +132,13 @@
embeddedResources = false;
dev = true;
};
graphite-bundle = import ./pkgs/graphite-bundle.nix {
inherit pkgs graphite;
};
graphite-flatpak-manifest = import ./pkgs/graphite-flatpak-manifest.nix {
inherit pkgs;
archive = graphite-bundle.tar;
};
#TODO: graphene-cli = import ./pkgs/graphene-cli.nix { inherit info pkgs inputs deps libs tools; };
raster-nodes-shaders = import ./pkgs/raster-nodes-shaders.nix {
inherit
Expand Down
91 changes: 91 additions & 0 deletions .nix/pkgs/graphite-bundle.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
pkgs,
graphite,
}:
let
bundle =
{
pkgs,
graphite,
archive ? false,
compression ? null,
passthru ? {},
}:
(
let
tar = if compression == null then archive else true;
nameArchiveSuffix = if tar then ".tar" else "";
nameCompressionSuffix = if compression == null then "" else "." + compression;
name = "graphite-bundle${nameArchiveSuffix}${nameCompressionSuffix}";
build = ''
mkdir -p out
mkdir -p out/bin
cp ${graphite}/bin/.graphite-wrapped 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
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
''
cd out
tar -c \
--sort=name \
--mtime='@1' --clamp-mtime \
--owner=0 --group=0 --numeric-owner \
--mode='u=rwX,go=rX' \
--format=posix \
--pax-option=delete=atime,delete=ctime \
--no-acls --no-xattrs --no-selinux \
* ${
if compression == "xz" then
"| xz "
else if compression == "gz" then
"| gzip -n "
else
""
}> $out
''
else
''
mkdir -p $out
cp -r out/* $out/
'';
in

pkgs.runCommand name
{
inherit passthru;
}
''
${build}
${install}
''
);
in
bundle {
inherit pkgs graphite;
passthru = {
tar = bundle {
inherit pkgs graphite;
archive = true;
passthru = {
gz = bundle {
inherit pkgs graphite;
compression = "gz";
};
xz = bundle {
inherit pkgs graphite;
compression = "xz";
};
};
};
};
}
37 changes: 37 additions & 0 deletions .nix/pkgs/graphite-flatpak-manifest.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
pkgs,
archive,
}:

(pkgs.formats.json { }).generate "art.graphite.Graphite.json" {
app-id = "art.graphite.Graphite";
runtime = "org.freedesktop.Platform";
runtime-version = "25.08";
sdk = "org.freedesktop.Sdk";
command = "graphite";
finish-args = [
"--device=dri"
"--share=ipc"
"--socket=wayland"
"--socket=fallback-x11"
"--share=network"
];
modules = [
{
name = "app";
buildsystem = "simple";
build-commands = [
"mkdir -p /app"
"cp -r ./* /app/"
"chmod +x /app/bin/*"
];
sources = [
{
type = "archive";
path = archive;
strip-components = 0;
}
];
}
];
}
2 changes: 1 addition & 1 deletion .nix/pkgs/graphite.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ deps.crane.lib.buildPackage (
cp $src/desktop/assets/*.desktop $out/share/applications/

mkdir -p $out/share/icons/hicolor/scalable/apps
cp ${branding}/app-icons/graphite.svg $out/share/icons/hicolor/scalable/apps/
cp ${branding}/app-icons/graphite.svg $out/share/icons/hicolor/scalable/apps/art.graphite.Graphite.svg
'';

postFixup = ''
Expand Down
Loading