mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
nix: use zig2nix to manage nix cache/deps
This brings the internal package more in line with how the nixpkgs package is built. It also handles recursive dependencies better than the current system.
This commit is contained in:

committed by
Mitchell Hashimoto

parent
ab71dac282
commit
3a8c934b19
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,3 +1,4 @@
|
||||
build.zig.zon.nix linguist-generated=true
|
||||
vendor/** linguist-vendored
|
||||
website/** linguist-documentation
|
||||
pkg/breakpad/vendor/** linguist-vendored
|
||||
|
4
.github/workflows/nix.yml
vendored
4
.github/workflows/nix.yml
vendored
@ -50,5 +50,5 @@ jobs:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
useDaemon: false # sometimes fails on short jobs
|
||||
- name: Check Zig cache hash
|
||||
run: nix develop -c ./nix/build-support/check-zig-cache-hash.sh
|
||||
- name: Check Zig cache
|
||||
run: nix develop -c ./nix/build-support/check-zig-cache.sh
|
||||
|
8
.github/workflows/update-colorschemes.yml
vendored
8
.github/workflows/update-colorschemes.yml
vendored
@ -48,14 +48,14 @@ jobs:
|
||||
run: |
|
||||
# Only proceed if build.zig.zon has changed
|
||||
if ! git diff --exit-code build.zig.zon; then
|
||||
nix develop -c ./nix/build-support/check-zig-cache-hash.sh --update
|
||||
nix develop -c ./nix/build-support/check-zig-cache-hash.sh
|
||||
nix develop -c ./nix/build-support/check-zig-cache.sh --update
|
||||
nix develop -c ./nix/build-support/check-zig-cache.sh
|
||||
fi
|
||||
|
||||
# Verify the build still works. We choose an arbitrary build type
|
||||
# as a canary instead of testing all build types.
|
||||
- name: Test Build
|
||||
run: nix develop -c zig build -Dapp-runtime=gtk -Dgtk-adwaita=true
|
||||
run: nix build .#ghostty
|
||||
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
@ -66,7 +66,7 @@ jobs:
|
||||
commit-message: "deps: Update iTerm2 color schemes"
|
||||
add-paths: |
|
||||
build.zig.zon
|
||||
nix/zigCacheHash.nix
|
||||
build.zig.zon.nix
|
||||
body: |
|
||||
Upstream revision: https://github.com/mbadolato/iTerm2-Color-Schemes/tree/${{ steps.zig_fetch.outputs.upstream_rev }}
|
||||
labels: dependencies
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,3 +18,4 @@ glad.zip
|
||||
/Box_test.ppm
|
||||
/Box_test_diff.ppm
|
||||
/ghostty.qcow2
|
||||
/build.zig.zon2json-lock
|
||||
|
390
build.zig.zon.nix
generated
Normal file
390
build.zig.zon.nix
generated
Normal file
@ -0,0 +1,390 @@
|
||||
# generated by zon2nix (https://github.com/Cloudef/zig2nix)
|
||||
{
|
||||
lib,
|
||||
linkFarm,
|
||||
fetchurl,
|
||||
fetchgit,
|
||||
runCommandLocal,
|
||||
zig,
|
||||
name ? "zig-packages",
|
||||
}:
|
||||
with builtins;
|
||||
with lib; let
|
||||
unpackZigArtifact = {
|
||||
name,
|
||||
artifact,
|
||||
}:
|
||||
runCommandLocal name
|
||||
{
|
||||
nativeBuildInputs = [zig];
|
||||
}
|
||||
''
|
||||
hash="$(zig fetch --global-cache-dir "$TMPDIR" ${artifact})"
|
||||
mv "$TMPDIR/p/$hash" "$out"
|
||||
chmod 755 "$out"
|
||||
'';
|
||||
|
||||
fetchZig = {
|
||||
name,
|
||||
url,
|
||||
hash,
|
||||
}: let
|
||||
artifact = fetchurl {inherit url hash;};
|
||||
in
|
||||
unpackZigArtifact {inherit name artifact;};
|
||||
|
||||
fetchGitZig = {
|
||||
name,
|
||||
url,
|
||||
hash,
|
||||
}: let
|
||||
parts = splitString "#" url;
|
||||
url_base = elemAt parts 0;
|
||||
url_without_query = elemAt (splitString "?" url_base) 0;
|
||||
rev_base = elemAt parts 1;
|
||||
rev =
|
||||
if match "^[a-fA-F0-9]{40}$" rev_base != null
|
||||
then rev_base
|
||||
else "refs/heads/${rev_base}";
|
||||
in
|
||||
fetchgit {
|
||||
inherit name rev hash;
|
||||
url = url_without_query;
|
||||
deepClone = false;
|
||||
};
|
||||
|
||||
fetchZigArtifact = {
|
||||
name,
|
||||
url,
|
||||
hash,
|
||||
}: let
|
||||
parts = splitString "://" url;
|
||||
proto = elemAt parts 0;
|
||||
path = elemAt parts 1;
|
||||
fetcher = {
|
||||
"git+http" = fetchGitZig {
|
||||
inherit name hash;
|
||||
url = "http://${path}";
|
||||
};
|
||||
"git+https" = fetchGitZig {
|
||||
inherit name hash;
|
||||
url = "https://${path}";
|
||||
};
|
||||
http = fetchZig {
|
||||
inherit name hash;
|
||||
url = "http://${path}";
|
||||
};
|
||||
https = fetchZig {
|
||||
inherit name hash;
|
||||
url = "https://${path}";
|
||||
};
|
||||
};
|
||||
in
|
||||
fetcher.${proto};
|
||||
in
|
||||
linkFarm name [
|
||||
{
|
||||
name = "1220ebf88622c4d502dc59e71347e4d28c47e033f11b59aff774ae5787565c40999c";
|
||||
path = fetchZigArtifact {
|
||||
name = "libxev";
|
||||
url = "https://github.com/mitchellh/libxev/archive/31eed4e337fed7b0149319e5cdbb62b848c24fbd.tar.gz";
|
||||
hash = "sha256-VHP90NTytIZ8UZsYRKOOxN490/I6yv6ec40sP8y5MJ8=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12206ed982e709e565d536ce930701a8c07edfd2cfdce428683f3f2a601d37696a62";
|
||||
path = fetchZigArtifact {
|
||||
name = "mach_glfw";
|
||||
url = "https://github.com/mitchellh/mach-glfw/archive/37c2995f31abcf7e8378fba68ddcf4a3faa02de0.tar.gz";
|
||||
hash = "sha256-HhXIvWUS8/CHWY4VXPG2ZEo+we8XOn3o5rYJCQ1n8Nk=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220736fa4ba211162c7a0e46cc8fe04d95921927688bff64ab5da7420d098a7272d";
|
||||
path = fetchZigArtifact {
|
||||
name = "glfw";
|
||||
url = "https://github.com/mitchellh/glfw/archive/b552c6ec47326b94015feddb36058ea567b87159.tar.gz";
|
||||
hash = "sha256-IeBVAOQmtyFqVxzuXPek1onuPwIamcOyYtxqKpPEQjU=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12202adbfecdad671d585c9a5bfcbd5cdf821726779430047742ce1bf94ad67d19cb";
|
||||
path = fetchZigArtifact {
|
||||
name = "xcode_frameworks";
|
||||
url = "https://github.com/mitchellh/xcode-frameworks/archive/69801c154c39d7ae6129ea1ba8fe1afe00585fc8.tar.gz";
|
||||
hash = "sha256-mP/I2coL57UJm/3+4Q8sPAgQwk8V4zM+S4VBBTrX2To=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "122004bfd4c519dadfb8e6281a42fc34fd1aa15aea654ea8a492839046f9894fa2cf";
|
||||
path = fetchZigArtifact {
|
||||
name = "vulkan_headers";
|
||||
url = "https://github.com/mitchellh/vulkan-headers/archive/04c8a0389d5a0236a96312988017cd4ce27d8041.tar.gz";
|
||||
hash = "sha256-K+zrRudgHFukOM6En1StRYRMNYkeRk+qHTXvrXaG+FU=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220b3164434d2ec9db146a40bf3a30f490590d68fa8529776a3138074f0da2c11ca";
|
||||
path = fetchZigArtifact {
|
||||
name = "wayland_headers";
|
||||
url = "https://github.com/mitchellh/wayland-headers/archive/5f991515a29f994d87b908115a2ab0b899474bd1.tar.gz";
|
||||
hash = "sha256-uFilLZinKkZt6RdVTV3lUmJpzpswDdFva22FvwU/XQI=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "122089c326186c84aa2fd034b16abc38f3ebf4862d9ae106dc1847ac44f557b36465";
|
||||
path = fetchZigArtifact {
|
||||
name = "x11_headers";
|
||||
url = "https://github.com/mitchellh/x11-headers/archive/2ffbd62d82ff73ec929dd8de802bc95effa0ef88.tar.gz";
|
||||
hash = "sha256-EhV2bmTY/OMYN1wEul35gD0hQgS/Al262jO3pVr0O+c=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12200df4ebeaed45de26cb2c9f3b6f3746d8013b604e035dae658f86f586c8c91d2f";
|
||||
path = fetchZigArtifact {
|
||||
name = "vaxis";
|
||||
url = "git+https://github.com/rockorager/libvaxis/?ref=main#6d729a2dc3b934818dffe06d2ba3ce02841ed74b";
|
||||
hash = "sha256-fFf79fCy4QQFVNcN722tSMjB6FyVEzCB36oH1olk9JQ=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220dd654ef941fc76fd96f9ec6adadf83f69b9887a0d3f4ee5ac0a1a3e11be35cf5";
|
||||
path = fetchZigArtifact {
|
||||
name = "zigimg";
|
||||
url = "git+https://github.com/zigimg/zigimg#3a667bdb3d7f0955a5a51c8468eac83210c1439e";
|
||||
hash = "sha256-oLf3YH3yeg4ikVO/GahMCDRMTU31AHkfSnF4rt7xTKo=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40";
|
||||
path = fetchZigArtifact {
|
||||
name = "zg";
|
||||
url = "https://codeberg.org/atman/zg/archive/v0.13.2.tar.gz";
|
||||
hash = "sha256-2x9hT7bYq9KJYWLVOf21a+QvTG/F7HWT+YK15IMRzNY=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12201f0d542e7541cf492a001d4d0d0155c92f58212fbcb0d224e95edeba06b5416a";
|
||||
path = fetchZigArtifact {
|
||||
name = "z2d";
|
||||
url = "git+https://github.com/vancluever/z2d?ref=v0.4.0#4638bb02a9dc41cc2fb811f092811f6a951c752a";
|
||||
hash = "sha256-YpWXn1J3JKQSCrWB25mAfzd1/T56QstEZnhPzBwxgoM=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220e17e64ef0ef561b3e4b9f3a96a2494285f2ec31c097721bf8c8677ec4415c634";
|
||||
path = fetchZigArtifact {
|
||||
name = "zig_objc";
|
||||
url = "https://github.com/mitchellh/zig-objc/archive/9b8ba849b0f58fe207ecd6ab7c147af55b17556e.tar.gz";
|
||||
hash = "sha256-H+HIbh2T23uzrsg9/1/vl9Ir1HCAa2pzeTx6zktJH9Q=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12205a66d423259567764fa0fc60c82be35365c21aeb76c5a7dc99698401f4f6fefc";
|
||||
path = fetchZigArtifact {
|
||||
name = "zig_js";
|
||||
url = "https://github.com/mitchellh/zig-js/archive/d0b8b0a57c52fbc89f9d9fecba75ca29da7dd7d1.tar.gz";
|
||||
hash = "sha256-fyNeCVbC9UAaKJY6JhAZlT0A479M/AKYMPIWEZbDWD0=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12207831bce7d4abce57b5a98e8f3635811cfefd160bca022eb91fe905d36a02cf25";
|
||||
path = fetchZigArtifact {
|
||||
name = "ziglyph";
|
||||
url = "https://deps.files.ghostty.org/ziglyph-b89d43d1e3fb01b6074bc1f7fc980324b04d26a5.tar.gz";
|
||||
hash = "sha256-cse98+Ft8QUjX+P88yyYfaxJOJGQ9M7Ymw7jFxDz89k=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12209ca054cb1919fa276e328967f10b253f7537c4136eb48f3332b0f7cf661cad38";
|
||||
path = fetchZigArtifact {
|
||||
name = "zig_wayland";
|
||||
url = "https://codeberg.org/ifreund/zig-wayland/archive/fbfe3b4ac0b472a27b1f1a67405436c58cbee12d.tar.gz";
|
||||
hash = "sha256-RtAystqK/GRYIquTK1KfD7rRSCrfuzAvCD1Z9DE1ldc=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220edc3b8d8bedbb50555947987e5e8e2f93871ca3c8e8d4cc8f1377c15b5dd35e8";
|
||||
path = fetchZigArtifact {
|
||||
name = "zf";
|
||||
url = "git+https://github.com/natecraddock/zf/?ref=main#ed99ca18b02dda052e20ba467e90b623c04690dd";
|
||||
hash = "sha256-t6QNrEJZ4GZZsYixjYvpdrYoCmNbG8TTUmGs2MFa4sU=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220c72c1697dd9008461ead702997a15d8a1c5810247f02e7983b9f74c6c6e4c087";
|
||||
path = fetchZigArtifact {
|
||||
name = "vaxis";
|
||||
url = "git+https://github.com/rockorager/libvaxis/?ref=main#dc0a228a5544988d4a920cfb40be9cd28db41423";
|
||||
hash = "sha256-QWN4jOrA91KlbqmeEHHJ4HTnCC9nmfxt8DHUXJpAzLI=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12208d70ee791d7ef7e16e1c3c9c1127b57f1ed066a24f87d57fc9f730c5dc394b9d";
|
||||
path = fetchZigArtifact {
|
||||
name = "gobject";
|
||||
url = "https://github.com/ianprime0509/zig-gobject/releases/download/v0.2.2/bindings-gnome47.tar.zst";
|
||||
hash = "sha256-UU97kNv/bZzQPKz1djhEDLapLguvfBpFfWVb6FthtcI=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12202cdac858abc52413a6c6711d5026d2d3c8e13f95ca2c327eade0736298bb021f";
|
||||
path = fetchZigArtifact {
|
||||
name = "wayland";
|
||||
url = "https://deps.files.ghostty.org/wayland-9cb3d7aa9dc995ffafdbdef7ab86a949d0fb0e7d.tar.gz";
|
||||
hash = "sha256-m9G72jdG30KH2yQhNBcBJ46OnekzuX0i2uIOyczkpLk=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12201a57c6ce0001aa034fa80fba3e1cd2253c560a45748f4f4dd21ff23b491cddef";
|
||||
path = fetchZigArtifact {
|
||||
name = "wayland_protocols";
|
||||
url = "https://deps.files.ghostty.org/wayland-protocols-258d8f88f2c8c25a830c6316f87d23ce1a0f12d9.tar.gz";
|
||||
hash = "sha256-XO3K3egbdeYPI+XoO13SuOtO+5+Peb16NH0UiusFMPg=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12207e0851c12acdeee0991e893e0132fc87bb763969a585dc16ecca33e88334c566";
|
||||
path = fetchZigArtifact {
|
||||
name = "plasma_wayland_protocols";
|
||||
url = "git+https://github.com/KDE/plasma-wayland-protocols?ref=main#db525e8f9da548cffa2ac77618dd0fbe7f511b86";
|
||||
hash = "sha256-iWRv3+OfmHxmeCJ8m0ChjgZX6mwXlcFmK8P/Vt8gDj4=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12203d2647e5daf36a9c85b969e03f422540786ce9ea624eb4c26d204fe1f46218f3";
|
||||
path = fetchZigArtifact {
|
||||
name = "iterm2_themes";
|
||||
url = "https://github.com/mbadolato/iTerm2-Color-Schemes/archive/db227d159adc265818f2e898da0f70ef8d7b580e.tar.gz";
|
||||
hash = "sha256-Iyf7U4rpvNkPX4AOEbYSYGte5+SjRwsWD2luOn1Hz8U=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220bc6b9daceaf7c8c60f3c3998058045ba0c5c5f48ae255ff97776d9cd8bfc6402";
|
||||
path = fetchZigArtifact {
|
||||
name = "imgui";
|
||||
url = "https://github.com/ocornut/imgui/archive/e391fe2e66eb1c96b1624ae8444dc64c23146ef4.tar.gz";
|
||||
hash = "sha256-oF/QHgTPEat4Hig4fGIdLkIPHmBEyOJ6JeYD6pnveGA=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220b81f6ecfb3fd222f76cf9106fecfa6554ab07ec7fdc4124b9bb063ae2adf969d";
|
||||
path = fetchZigArtifact {
|
||||
name = "freetype";
|
||||
url = "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-2.tar.gz";
|
||||
hash = "sha256-QnIB9dUVFnDQXB9bRb713aHy592XHvVPD+qqf/0quQw=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220aa013f0c83da3fb64ea6d327f9173fa008d10e28bc9349eac3463457723b1c66";
|
||||
path = fetchZigArtifact {
|
||||
name = "libpng";
|
||||
url = "https://github.com/glennrp/libpng/archive/refs/tags/v1.6.43.tar.gz";
|
||||
hash = "sha256-/syVtGzwXo4/yKQUdQ4LparQDYnp/fF16U/wQcrxoDo=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220fed0c74e1019b3ee29edae2051788b080cd96e90d56836eea857b0b966742efb";
|
||||
path = fetchZigArtifact {
|
||||
name = "zlib";
|
||||
url = "https://github.com/madler/zlib/archive/refs/tags/v1.3.1.tar.gz";
|
||||
hash = "sha256-F+iIY/NgBnKrSRgvIXKBtvxNPHYr3jYZNeQ2qVIU0Fw=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12201149afb3326c56c05bb0a577f54f76ac20deece63aa2f5cd6ff31a4fa4fcb3b7";
|
||||
path = fetchZigArtifact {
|
||||
name = "fontconfig";
|
||||
url = "https://deps.files.ghostty.org/fontconfig-2.14.2.tar.gz";
|
||||
hash = "sha256-O6LdkhWHGKzsXKrxpxYEO1qgVcJ7CB2RSvPMtA3OilU=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "122032442d95c3b428ae8e526017fad881e7dc78eab4d558e9a58a80bfbd65a64f7d";
|
||||
path = fetchZigArtifact {
|
||||
name = "libxml2";
|
||||
url = "https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.5.tar.gz";
|
||||
hash = "sha256-bCgFni4+60K1tLFkieORamNGwQladP7jvGXNxdiaYhU=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220b8588f106c996af10249bfa092c6fb2f35fbacb1505ef477a0b04a7dd1063122";
|
||||
path = fetchZigArtifact {
|
||||
name = "harfbuzz";
|
||||
url = "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/8.4.0.tar.gz";
|
||||
hash = "sha256-nxygiYE7BZRK0c6MfgGCEwJtNdybq0gKIeuHaDg5ZVY=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12205c83b8311a24b1d5ae6d21640df04f4b0726e314337c043cde1432758cbe165b";
|
||||
path = fetchZigArtifact {
|
||||
name = "highway";
|
||||
url = "https://github.com/google/highway/archive/refs/tags/1.1.0.tar.gz";
|
||||
hash = "sha256-NUqLRTm1iOcLmOxwhEJz4/J0EwLEw3e8xOgbPRhm98k=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220c15e72eadd0d9085a8af134904d9a0f5dfcbed5f606ad60edc60ebeccd9706bb";
|
||||
path = fetchZigArtifact {
|
||||
name = "oniguruma";
|
||||
url = "https://github.com/kkos/oniguruma/archive/refs/tags/v6.9.9.tar.gz";
|
||||
hash = "sha256-ABqhIC54RI9MC/GkjHblVodrNvFtks4yB+zP1h2Z8qA=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220446be831adcca918167647c06c7b825849fa3fba5f22da394667974537a9c77e";
|
||||
path = fetchZigArtifact {
|
||||
name = "sentry";
|
||||
url = "https://github.com/getsentry/sentry-native/archive/refs/tags/0.7.8.tar.gz";
|
||||
hash = "sha256-KsZJfMjWGo0xCT5HrduMmyxFsWsHBbszSoNbZCPDGN8=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12207fd37bb8251919c112dcdd8f616a491857b34a451f7e4486490077206dc2a1ea";
|
||||
path = fetchZigArtifact {
|
||||
name = "breakpad";
|
||||
url = "https://github.com/getsentry/breakpad/archive/b99f444ba5f6b98cac261cbb391d8766b34a5918.tar.gz";
|
||||
hash = "sha256-bMqYlD0amQdmzvYQd8Ca/1k4Bj/heh7+EijlQSttatk=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220d4d18426ca72fc2b7e56ce47273149815501d0d2395c2a98c726b31ba931e641";
|
||||
path = fetchZigArtifact {
|
||||
name = "utfcpp";
|
||||
url = "https://github.com/nemtrif/utfcpp/archive/refs/tags/v4.0.5.tar.gz";
|
||||
hash = "sha256-/8ZooxDndgfTk/PBizJxXyI9oerExNbgV5oR345rWc8=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "122037b39d577ec2db3fd7b2130e7b69ef6cc1807d68607a7c232c958315d381b5cd";
|
||||
path = fetchZigArtifact {
|
||||
name = "wuffs";
|
||||
url = "https://github.com/google/wuffs/archive/refs/tags/v0.4.0-alpha.9.tar.gz";
|
||||
hash = "sha256-nkzSCr6W5sTG7enDBXEIhgEm574uLD41UVR2wlC+HBM=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12207ff340169c7d40c570b4b6a97db614fe47e0d83b5801a932dcd44917424c8806";
|
||||
path = fetchZigArtifact {
|
||||
name = "pixels";
|
||||
url = "git+https://github.com/make-github-pseudonymous-again/pixels?ref=main#d843c2714d32e15b48b8d7eeb480295af537f877";
|
||||
hash = "sha256-kXYGO0qn2PfyOYCrRA49BHIgTzdmKhI8SNO1ZKfUYEE=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "12201278a1a05c0ce0b6eb6026c65cd3e9247aa041b1c260324bf29cee559dd23ba1";
|
||||
path = fetchZigArtifact {
|
||||
name = "glslang";
|
||||
url = "https://github.com/KhronosGroup/glslang/archive/refs/tags/14.2.0.tar.gz";
|
||||
hash = "sha256-FKLtu1Ccs+UamlPj9eQ12/WXFgS0uDPmPmB26MCpl7U=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "1220fb3b5586e8be67bc3feb34cbe749cf42a60d628d2953632c2f8141302748c8da";
|
||||
path = fetchZigArtifact {
|
||||
name = "spirv_cross";
|
||||
url = "https://github.com/KhronosGroup/SPIRV-Cross/archive/476f384eb7d9e48613c45179e502a15ab95b6b49.tar.gz";
|
||||
hash = "sha256-tStvz8Ref6abHwahNiwVVHNETizAmZVVaxVsU7pmV+M=";
|
||||
};
|
||||
}
|
||||
]
|
62
flake.lock
generated
62
flake.lock
generated
@ -3,11 +3,11 @@
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"lastModified": 1733328505,
|
||||
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -21,11 +21,11 @@
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -36,11 +36,11 @@
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1733423277,
|
||||
"narHash": "sha256-TxabjxEgkNbCGFRHgM/b9yZWlBj60gUOUnRT/wbVQR8=",
|
||||
"lastModified": 1738255539,
|
||||
"narHash": "sha256-hP2eOqhIO/OILW+3moNWO4GtdJFYCqAe9yJZgvlCoDQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e36963a147267afc055f7cf65225958633e536bf",
|
||||
"rev": "c3511a3b53b482aa7547c9d1626fd7310c1de1c5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -52,11 +52,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1733229606,
|
||||
"narHash": "sha256-FLYY5M0rpa5C2QAE3CKLYAM6TwbKicdRK6qNrSHlNrE=",
|
||||
"lastModified": 1738136902,
|
||||
"narHash": "sha256-pUvLijVGARw4u793APze3j6mU1Zwdtz7hGkGGkD87qw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "566e53c2ad750c84f6d31f9ccb9d00f823165550",
|
||||
"rev": "9a5db3142ce450045840cc8d832b13b8a2018e0c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -69,9 +69,11 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs-stable": "nixpkgs-stable",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"zig": "zig"
|
||||
"zig": "zig",
|
||||
"zig2nix": "zig2nix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
@ -92,17 +94,19 @@
|
||||
"zig": {
|
||||
"inputs": {
|
||||
"flake-compat": [],
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs-stable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717848532,
|
||||
"narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=",
|
||||
"lastModified": 1738239110,
|
||||
"narHash": "sha256-Y5i9mQ++dyIQr+zEPNy+KIbc5wjPmfllBrag3cHZgcE=",
|
||||
"owner": "mitchellh",
|
||||
"repo": "zig-overlay",
|
||||
"rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43",
|
||||
"rev": "1a8fb6f3a04724519436355564b95fce5e272504",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -110,6 +114,30 @@
|
||||
"repo": "zig-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zig2nix": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs-stable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738263917,
|
||||
"narHash": "sha256-j/3fwe2pEOquHabP/puljOKwAZFjIE9gXZqA91sC48M=",
|
||||
"owner": "jcollie",
|
||||
"repo": "zig2nix",
|
||||
"rev": "c311d8e77a6ee0d995f40a6e10a89a3a4ab04f9a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "jcollie",
|
||||
"ref": "c311d8e77a6ee0d995f40a6e10a89a3a4ab04f9a",
|
||||
"repo": "zig2nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
12
flake.nix
12
flake.nix
@ -8,6 +8,7 @@
|
||||
# glibc versions used by our dependencies from Nix are compatible with the
|
||||
# system glibc that the user is building for.
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/release-24.11";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
# Used for shell.nix
|
||||
flake-compat = {
|
||||
@ -19,9 +20,18 @@
|
||||
url = "github:mitchellh/zig-overlay";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs-stable";
|
||||
flake-utils.follows = "flake-utils";
|
||||
flake-compat.follows = "";
|
||||
};
|
||||
};
|
||||
|
||||
zig2nix = {
|
||||
url = "github:jcollie/zig2nix?ref=c311d8e77a6ee0d995f40a6e10a89a3a4ab04f9a";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs-stable";
|
||||
flake-utils.follows = "flake-utils";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
@ -29,6 +39,7 @@
|
||||
nixpkgs-unstable,
|
||||
nixpkgs-stable,
|
||||
zig,
|
||||
zig2nix,
|
||||
...
|
||||
}:
|
||||
builtins.foldl' nixpkgs-stable.lib.recursiveUpdate {} (
|
||||
@ -40,6 +51,7 @@
|
||||
devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix {
|
||||
zig = zig.packages.${system}."0.13.0";
|
||||
wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {};
|
||||
zig2nix = zig2nix;
|
||||
};
|
||||
|
||||
packages.${system} = let
|
||||
|
@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nothing in this script should fail.
|
||||
set -e
|
||||
|
||||
CACHE_HASH_FILE="$(realpath "$(dirname "$0")/../zigCacheHash.nix")"
|
||||
|
||||
help() {
|
||||
echo ""
|
||||
echo "To fix, please (manually) re-run the script from the repository root,"
|
||||
echo "commit, and push the update:"
|
||||
echo ""
|
||||
echo " ./nix/build-support/check-zig-cache-hash.sh --update"
|
||||
echo " git add nix/zigCacheHash.nix"
|
||||
echo " git commit -m \"nix: update Zig cache hash\""
|
||||
echo " git push"
|
||||
echo ""
|
||||
}
|
||||
|
||||
if [ -f "${CACHE_HASH_FILE}" ]; then
|
||||
OLD_CACHE_HASH="$(nix eval --raw --file "${CACHE_HASH_FILE}")"
|
||||
elif [ "$1" != "--update" ]; then
|
||||
echo -e "\nERROR: Zig cache hash file missing."
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ZIG_GLOBAL_CACHE_DIR="$(mktemp --directory --suffix nix-zig-cache)"
|
||||
export ZIG_GLOBAL_CACHE_DIR
|
||||
|
||||
# This is not 100% necessary in CI but is helpful when running locally to keep
|
||||
# a local workstation clean.
|
||||
trap 'rm -rf "${ZIG_GLOBAL_CACHE_DIR}"' EXIT
|
||||
|
||||
# Run Zig and download the cache to the temporary directory.
|
||||
|
||||
sh ./nix/build-support/fetch-zig-cache.sh
|
||||
|
||||
# Now, calculate the hash.
|
||||
ZIG_CACHE_HASH="sha256-$(nix-hash --type sha256 --to-base64 "$(nix-hash --type sha256 "${ZIG_GLOBAL_CACHE_DIR}")")"
|
||||
|
||||
if [ "${OLD_CACHE_HASH}" == "${ZIG_CACHE_HASH}" ]; then
|
||||
echo -e "\nOK: Zig cache store hash unchanged."
|
||||
exit 0
|
||||
elif [ "$1" != "--update" ]; then
|
||||
echo -e "\nERROR: The Zig cache store hash has updated."
|
||||
echo ""
|
||||
echo " * Old hash: ${OLD_CACHE_HASH}"
|
||||
echo " * New hash: ${ZIG_CACHE_HASH}"
|
||||
help
|
||||
exit 1
|
||||
else
|
||||
echo -e "\nNew Zig cache store hash: ${ZIG_CACHE_HASH}"
|
||||
fi
|
||||
|
||||
# Write out the cache file
|
||||
cat > "${CACHE_HASH_FILE}" <<EOS
|
||||
# This file is auto-generated! check build-support/check-zig-cache-hash.sh for
|
||||
# more details.
|
||||
"${ZIG_CACHE_HASH}"
|
||||
EOS
|
||||
|
||||
echo -e "\nOK: Wrote new hash to file: ${CACHE_HASH_FILE}"
|
64
nix/build-support/check-zig-cache.sh
Executable file
64
nix/build-support/check-zig-cache.sh
Executable file
@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nothing in this script should fail.
|
||||
set -e
|
||||
|
||||
WORK_DIR=$(mktemp -d)
|
||||
|
||||
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
|
||||
echo "could not create temp dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function cleanup {
|
||||
rm -rf "$WORK_DIR"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
help() {
|
||||
echo ""
|
||||
echo "To fix, please (manually) re-run the script from the repository root,"
|
||||
echo "commit, and submit a PR with the update:"
|
||||
echo ""
|
||||
echo " ./nix/build-support/check-zig-cache-hash.sh --update"
|
||||
echo " git add build.zig.zon.nix"
|
||||
echo " git commit -m \"nix: update build.zig.zon.nix\""
|
||||
echo ""
|
||||
}
|
||||
|
||||
BUILD_ZIG_ZON="$(realpath "$(dirname "$0")/../../build.zig.zon")"
|
||||
BUILD_ZIG_ZON_LOCK="$(realpath "$(dirname "$0")/../../build.zig.zon2json-lock")"
|
||||
BUILD_ZIG_ZON_NIX="$(realpath "$(dirname "$0")/../../build.zig.zon.nix")"
|
||||
|
||||
if [ -f "${BUILD_ZIG_ZON_NIX}" ]; then
|
||||
OLD_HASH=$(sha512sum "${BUILD_ZIG_ZON_NIX}" | awk '{print $1}')
|
||||
elif [ "$1" != "--update" ]; then
|
||||
echo -e "\nERROR: build.zig.zon.nix missing."
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f "$BUILD_ZIG_ZON_LOCK"
|
||||
zon2nix "$BUILD_ZIG_ZON" > "$WORK_DIR/build.zig.zon.nix"
|
||||
alejandra --quiet "$WORK_DIR/build.zig.zon.nix"
|
||||
rm -f "$BUILD_ZIG_ZON_LOCK"
|
||||
|
||||
NEW_HASH=$(sha512sum "$WORK_DIR/build.zig.zon.nix" | awk '{print $1}')
|
||||
|
||||
if [ "${OLD_HASH}" == "${NEW_HASH}" ]; then
|
||||
echo -e "\nOK: build.zig.zon.nix unchanged."
|
||||
exit 0
|
||||
elif [ "$1" != "--update" ]; then
|
||||
echo -e "\nERROR: build.zig.zon.nix needs to be updated."
|
||||
echo ""
|
||||
echo " * Old hash: ${OLD_HASH}"
|
||||
echo " * New hash: ${NEW_HASH}"
|
||||
help
|
||||
exit 1
|
||||
else
|
||||
mv "$WORK_DIR/build.zig.zon.nix" "$BUILD_ZIG_ZON_NIX"
|
||||
echo -e "\nOK: build.zig.zon.nix updated."
|
||||
exit 0
|
||||
fi
|
||||
|
@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Because Zig does not fetch recursive dependencies when you run `zig build
|
||||
# --fetch` (see https://github.com/ziglang/zig/issues/20976) we need to do some
|
||||
# extra work to fetch everything that we actually need to build without Internet
|
||||
# access (such as when building a Nix package).
|
||||
#
|
||||
# An example of this happening:
|
||||
#
|
||||
# error: builder for '/nix/store/cx8qcwrhjmjxik2547fw99v5j6np5san-ghostty-0.1.0.drv' failed with exit code 1;
|
||||
# la/build/tmp.xgHOheUF7V/p/12208cfdda4d5fdbc81b0c44b82e4d6dba2d4a86bff644a153e026fdfc80f8469133/build.zig.zon:7:20: error: unable to discover remote git server capabilities: TemporaryNameServerFailure
|
||||
# > .url = "git+https://github.com/zigimg/zigimg#3a667bdb3d7f0955a5a51c8468eac83210c1439e",
|
||||
# > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# > /build/tmp.xgHOheUF7V/p/12208cfdda4d5fdbc81b0c44b82e4d6dba2d4a86bff644a153e026fdfc80f8469133/build.zig.zon:16:20: error: unable to discover remote git server capabilities: TemporaryNameServerFailure
|
||||
# > .url = "git+https://github.com/mitchellh/libxev#f6a672a78436d8efee1aa847a43a900ad773618b",
|
||||
# > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# >
|
||||
# For full logs, run 'nix log /nix/store/cx8qcwrhjmjxik2547fw99v5j6np5san-ghostty-0.1.0.drv'.
|
||||
#
|
||||
# To update this script, add any failing URLs with a line like this:
|
||||
#
|
||||
# zig fetch <url>
|
||||
#
|
||||
# Periodically old URLs may need to be cleaned out.
|
||||
#
|
||||
# Hopefully when the Zig issue is fixed this script can be eliminated in favor
|
||||
# of a plain `zig build --fetch`.
|
||||
|
||||
if [ -z ${ZIG_GLOBAL_CACHE_DIR+x} ]
|
||||
then
|
||||
echo "must set ZIG_GLOBAL_CACHE_DIR!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
zig build --fetch
|
||||
zig fetch git+https://github.com/zigimg/zigimg#3a667bdb3d7f0955a5a51c8468eac83210c1439e
|
||||
zig fetch git+https://github.com/mitchellh/libxev#f6a672a78436d8efee1aa847a43a900ad773618b
|
@ -55,6 +55,8 @@
|
||||
wayland,
|
||||
wayland-scanner,
|
||||
wayland-protocols,
|
||||
zig2nix,
|
||||
system,
|
||||
}: let
|
||||
# See package.nix. Keep in sync.
|
||||
rpathLibs =
|
||||
@ -102,6 +104,7 @@ in
|
||||
scdoc
|
||||
zig
|
||||
zip
|
||||
zig2nix.packages.${system}.zon2nix
|
||||
|
||||
# For web and wasm stuff
|
||||
nodejs
|
||||
|
@ -2,6 +2,7 @@
|
||||
lib,
|
||||
stdenv,
|
||||
bzip2,
|
||||
callPackage,
|
||||
expat,
|
||||
fontconfig,
|
||||
freetype,
|
||||
@ -43,6 +44,10 @@
|
||||
zig_hook = zig_0_13.hook.overrideAttrs {
|
||||
zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize} --color off";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "ghostty";
|
||||
version = "1.1.1";
|
||||
|
||||
# We limit source like this to try and reduce the amount of rebuilds as possible
|
||||
# thus we only provide the source that is needed for the build
|
||||
@ -61,62 +66,12 @@
|
||||
../vendor
|
||||
../build.zig
|
||||
../build.zig.zon
|
||||
./build-support/fetch-zig-cache.sh
|
||||
../build.zig.zon.nix
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
# This hash is the computation of the zigCache fixed-output derivation. This
|
||||
# allows us to use remote package dependencies without breaking the sandbox.
|
||||
#
|
||||
# This will need updating whenever dependencies get updated (e.g. changes are
|
||||
# made to zig.build.zon). If you see that the main build is trying to reach
|
||||
# out to the internet and failing, this is likely the cause. Change this
|
||||
# value back to lib.fakeHash, and re-run. The build failure should emit the
|
||||
# updated hash, which of course, should be validated before updating here.
|
||||
#
|
||||
# (It's also possible that you might see a hash mismatch - without the
|
||||
# network errors - if you don't have a previous instance of the cache
|
||||
# derivation in your store already. If so, just update the value as above.)
|
||||
zigCacheHash = import ./zigCacheHash.nix;
|
||||
|
||||
zigCache = stdenv.mkDerivation {
|
||||
inherit src;
|
||||
name = "ghostty-cache";
|
||||
nativeBuildInputs = [
|
||||
git
|
||||
zig_hook
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
dontUseZigBuild = true;
|
||||
dontUseZigInstall = true;
|
||||
dontFixup = true;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
sh ./nix/build-support/fetch-zig-cache.sh
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -r --reflink=auto $ZIG_GLOBAL_CACHE_DIR $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHash = zigCacheHash;
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "ghostty";
|
||||
version = "1.1.1";
|
||||
inherit src;
|
||||
deps = callPackage ../build.zig.zon.nix {name = "ghostty-cache-${finalAttrs.version}";};
|
||||
|
||||
nativeBuildInputs =
|
||||
[
|
||||
@ -166,7 +121,7 @@ in
|
||||
|
||||
zigBuildFlags = [
|
||||
"--system"
|
||||
"${zigCache}/p"
|
||||
"${finalAttrs.deps}"
|
||||
"-Dversion-string=${finalAttrs.version}-${revision}-nix"
|
||||
"-Dgtk-x11=${lib.boolToString enableX11}"
|
||||
"-Dgtk-wayland=${lib.boolToString enableWayland}"
|
||||
|
@ -1,3 +0,0 @@
|
||||
# This file is auto-generated! check build-support/check-zig-cache-hash.sh for
|
||||
# more details.
|
||||
"sha256-+Ag900R3lDV7iEeRFGe2HWJDtquW3I9GFvHGle+U3k0="
|
Reference in New Issue
Block a user