Skip to content

Commit da7437c

Browse files
Reimplement notice file generation for third-party licenses through Rust, now with CEF credits (#3808)
1 parent 4090f6c commit da7437c

File tree

40 files changed

+1731
-779
lines changed

40 files changed

+1731
-779
lines changed

.github/workflows/build-win-bundle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
cargo binstall --no-confirm --force "wasm-bindgen-cli@$env:WASM_BINDGEN_CLI_VERSION"
7171
7272
- name: Build Windows Bundle
73+
shell: bash # `cargo-about` refuses to run in powershell
7374
env:
7475
CARGO_TERM_COLOR: always
7576
run: npm run build-desktop

.github/workflows/provide-shaders.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: DeterminateSystems/magic-nix-cache-action@main
1818

1919
- name: Build graphene raster nodes shaders
20-
run: nix build .nix#raster-nodes-shaders && cp result raster_nodes_shaders_entrypoint.wgsl
20+
run: nix build .nix#graphite-raster-nodes-shaders && cp result raster_nodes_shaders_entrypoint.wgsl
2121

2222
- name: Upload graphene raster nodes shaders to artifacts repository
2323
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
branding/
22
target/
3+
third-party-licenses.txt*
34
result/
45
.flatpak-builder/
56
*.spv

.nix/deps/cef.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, inputs, ... }:
1+
{ pkgs, ... }:
22

33
let
44
cefPath = pkgs.cef-binary.overrideAttrs (finalAttrs: {
@@ -10,6 +10,8 @@ let
1010
mv ./Resources/* $out/
1111
mv ./include $out/
1212
13+
cat ./CREDITS.html | ${pkgs.xz}/bin/xz -9 -e -c > $out/CREDITS.html.xz
14+
1315
echo '${
1416
builtins.toJSON {
1517
type = "minimal";

.nix/deps/rust-gpu.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, inputs, ... }:
1+
{ pkgs, ... }:
22

33
let
44
extensions = [

.nix/dev.nix

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,58 @@
1-
{
2-
pkgs,
3-
deps,
4-
libs,
5-
tools,
6-
...
7-
}:
1+
{ pkgs, deps, ... }:
82

3+
let
4+
libs = [
5+
pkgs.wayland
6+
pkgs.vulkan-loader
7+
pkgs.libGL
8+
pkgs.openssl
9+
pkgs.libraw
10+
11+
# X11 Support
12+
pkgs.libxkbcommon
13+
pkgs.libXcursor
14+
pkgs.libxcb
15+
pkgs.libX11
16+
];
17+
in
918
pkgs.mkShell (
1019
{
11-
packages = tools.all ++ libs.all;
20+
packages = libs ++ [
21+
pkgs.pkg-config
22+
23+
pkgs.lld
24+
pkgs.nodejs
25+
pkgs.nodePackages.npm
26+
pkgs.binaryen
27+
pkgs.wasm-bindgen-cli_0_2_100
28+
pkgs.wasm-pack
29+
pkgs.cargo-about
30+
31+
pkgs.rustc
32+
pkgs.cargo
33+
pkgs.rust-analyzer
34+
pkgs.clippy
35+
pkgs.rustfmt
36+
37+
pkgs.git
38+
39+
pkgs.cargo-watch
40+
pkgs.cargo-nextest
41+
pkgs.cargo-expand
42+
43+
# Linker
44+
pkgs.mold
45+
46+
# Profiling tools
47+
pkgs.gnuplot
48+
pkgs.samply
49+
pkgs.cargo-flamegraph
50+
51+
# Plotting tools
52+
pkgs.graphviz
53+
];
1254

13-
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs.all}:${deps.cef.env.CEF_PATH}";
55+
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs}:${deps.cef.env.CEF_PATH}";
1456
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";
1557

1658
shellHook = ''

.nix/flake.lock

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.nix/flake.nix

Lines changed: 69 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
url = "github:oxalica/rust-overlay";
1919
inputs.nixpkgs.follows = "nixpkgs";
2020
};
21-
flake-utils.url = "github:numtide/flake-utils";
2221
crane.url = "github:ipetkov/crane";
2322

2423
# This is used to provide a identical development shell at `shell.nix` for users that do not use flakes
@@ -27,143 +26,85 @@
2726

2827
outputs =
2928
inputs:
30-
inputs.flake-utils.lib.eachDefaultSystem (
31-
system:
29+
(
3230
let
33-
info = {
34-
pname = "graphite";
35-
version = "unstable";
36-
src = pkgs.lib.cleanSourceWith {
37-
src = ./..;
38-
filter = path: type: !(type == "directory" && builtins.baseNameOf path == ".nix");
39-
};
40-
};
41-
42-
pkgs = import inputs.nixpkgs {
43-
inherit system;
44-
overlays = [ (import inputs.rust-overlay) ];
45-
};
46-
47-
deps = {
48-
crane = import ./deps/crane.nix { inherit pkgs inputs; };
49-
cef = import ./deps/cef.nix { inherit pkgs inputs; };
50-
rustGPU = import ./deps/rust-gpu.nix { inherit pkgs inputs; };
51-
};
52-
53-
libs = rec {
54-
desktop = [
55-
pkgs.wayland
56-
pkgs.openssl
57-
pkgs.vulkan-loader
58-
pkgs.libraw
59-
pkgs.libGL
60-
];
61-
desktop-x11 = [
62-
pkgs.libxkbcommon
63-
pkgs.xorg.libXcursor
64-
pkgs.xorg.libxcb
65-
pkgs.xorg.libX11
66-
];
67-
desktop-all = desktop ++ desktop-x11;
68-
all = desktop-all;
69-
};
70-
71-
tools = rec {
72-
desktop = [
73-
pkgs.pkg-config
74-
];
75-
frontend = [
76-
pkgs.lld
77-
pkgs.nodejs
78-
pkgs.nodePackages.npm
79-
pkgs.binaryen
80-
pkgs.wasm-bindgen-cli_0_2_100
81-
pkgs.wasm-pack
82-
pkgs.cargo-about
83-
];
84-
dev = [
85-
pkgs.rustc
86-
pkgs.cargo
87-
pkgs.rust-analyzer
88-
pkgs.clippy
89-
pkgs.rustfmt
90-
91-
pkgs.git
31+
systems = [
32+
"x86_64-linux"
33+
"aarch64-linux"
34+
];
35+
forAllSystems = f: inputs.nixpkgs.lib.genAttrs systems (system: f system);
36+
args =
37+
system:
38+
(
39+
let
40+
lib = inputs.nixpkgs.lib // {
41+
call = p: import p args;
42+
};
9243

93-
pkgs.cargo-watch
94-
pkgs.cargo-nextest
95-
pkgs.cargo-expand
44+
pkgs = import inputs.nixpkgs {
45+
inherit system;
46+
overlays = [ (import inputs.rust-overlay) ];
47+
};
9648

97-
# Linker
98-
pkgs.mold
49+
info = {
50+
pname = "graphite";
51+
version = "unstable";
52+
src = inputs.nixpkgs.lib.cleanSourceWith {
53+
src = ./..;
54+
filter = path: type: !(type == "directory" && builtins.baseNameOf path == ".nix");
55+
};
56+
cargoVendored = deps.crane.lib.vendorCargoDeps { inherit (info) src; };
57+
};
9958

100-
# Profiling tools
101-
pkgs.gnuplot
102-
pkgs.samply
103-
pkgs.cargo-flamegraph
59+
deps = {
60+
crane = lib.call ./deps/crane.nix;
61+
cef = lib.call ./deps/cef.nix;
62+
rustGPU = lib.call ./deps/rust-gpu.nix;
63+
};
10464

105-
# Plotting tools
106-
pkgs.graphviz
107-
];
108-
all = desktop ++ frontend ++ dev;
109-
};
65+
args = {
66+
inherit system;
67+
inherit (inputs) self;
68+
inherit inputs;
69+
inherit pkgs;
70+
inherit lib;
71+
inherit info;
72+
inherit deps;
73+
}
74+
// inputs;
75+
in
76+
args
77+
);
78+
withArgs = f: forAllSystems (system: f (args system));
11079
in
11180
{
112-
packages = rec {
113-
graphiteWithArgs =
114-
args:
115-
(import ./pkgs/graphite.nix {
116-
pkgs = pkgs // {
117-
inherit raster-nodes-shaders;
118-
};
119-
inherit
120-
info
121-
inputs
122-
deps
123-
libs
124-
tools
125-
;
126-
})
127-
args;
128-
graphite = graphiteWithArgs { };
129-
graphite-dev = graphiteWithArgs { dev = true; };
130-
graphite-without-resources = graphiteWithArgs { embeddedResources = false; };
131-
graphite-without-resources-dev = graphiteWithArgs {
132-
embeddedResources = false;
133-
dev = true;
134-
};
135-
graphite-bundle = import ./pkgs/graphite-bundle.nix {
136-
inherit pkgs graphite;
137-
};
138-
graphite-flatpak-manifest = import ./pkgs/graphite-flatpak-manifest.nix {
139-
inherit pkgs;
140-
archive = graphite-bundle.tar;
141-
};
142-
#TODO: graphene-cli = import ./pkgs/graphene-cli.nix { inherit info pkgs inputs deps libs tools; };
143-
raster-nodes-shaders = import ./pkgs/raster-nodes-shaders.nix {
144-
inherit
145-
info
146-
pkgs
147-
inputs
148-
deps
149-
libs
150-
tools
151-
;
152-
};
81+
packages = withArgs (
82+
{ lib, ... }:
83+
rec {
84+
default = graphite;
85+
graphite = (lib.call ./pkgs/graphite.nix) { };
86+
graphite-dev = (lib.call ./pkgs/graphite.nix) { dev = true; };
87+
graphite-raster-nodes-shaders = lib.call ./pkgs/graphite-raster-nodes-shaders.nix;
88+
graphite-branding = lib.call ./pkgs/graphite-branding.nix;
89+
graphite-bundle = lib.call ./pkgs/graphite-bundle.nix;
90+
graphite-flatpak-manifest = lib.call ./pkgs/graphite-flatpak-manifest.nix;
91+
92+
# TODO: graphene-cli = lib.call ./pkgs/graphene-cli.nix;
15393

154-
default = graphite;
155-
};
94+
tools = {
95+
third-party-licenses = lib.call ./pkgs/tools/third-party-licenses.nix;
96+
};
97+
}
98+
);
15699

157-
devShells.default = import ./dev.nix {
158-
inherit
159-
pkgs
160-
deps
161-
libs
162-
tools
163-
;
164-
};
100+
devShells = withArgs (
101+
{ lib, ... }:
102+
{
103+
default = lib.call ./dev.nix;
104+
}
105+
);
165106

166-
formatter = pkgs.nixfmt-tree;
107+
formatter = withArgs ({ pkgs, ... }: pkgs.nixfmt-tree);
167108
}
168109
);
169110
}

0 commit comments

Comments
 (0)