16 Commits

Author SHA1 Message Date
Jeffrey C. Ollie
8d0c3c7b7c gtk: implement custom audio for bell 2025-05-13 10:01:54 -05:00
Jeffrey C. Ollie
648e0a06ab CI: Add checks for blueprint compiler / Nix refactors
1. Refactored Nix devshell/package to make it easier to keep
   LD_LIBRARY_PATH & buildInputs in sync (plus make it easier to re-use
   in other Nix environment).
2. Added a CI job to ensure that Blueprints are formatted correctly and
   that they will compile using `blueprint-compiler` 0.16.0.
3. Reformatted all Blueprints with `blueprint-compiler format`.
2025-03-18 16:12:49 -05:00
Jeffrey C. Ollie
5cd8ebdafd update zon2nix
Upstream is now mostly pure Zig and the build.zig.zon.* files are
generated directly by zon2nix. The JSON file is no longer used as an
intermediate file but is retained for downstream packager usage.
2025-03-16 01:09:52 -05:00
Mitchell Hashimoto
b123b14686 update zig2nix 2025-03-12 15:56:24 -07:00
Mitchell Hashimoto
8231ebb770 build: mirror most of our direct dependencies
This adds a new script `update-mirror.sh` which generates the proper
blob format for R2 (or any blob storage) to mirror all of our
dependencies.

It doesn't automate updating build.zig.zon but on an ongoing basis this
should be easy to do manually, and we can strive to automate it in the
future.

I omitted iTerm2 color themes because we auto-update that via CI and
updating all of the machinery to send it to our mirror and so on is a
pain. Additionally, this doesn't mirror transitive dependencies because
Zig doesn't have a way to fetch those from a mirror instead (unless you
pre-generate a full cache like packagers but that's not practical for
day to day development).

It's hugely beneficial just to get most of our dependencies mirrored.
2025-02-14 10:06:15 -08:00
Jeffrey C. Ollie
f32ad5216b build: generate a build.zig.zon.txt file for easy zig fetch scripting
This fixes a regression in 1.1.1/1.1.2 where our PACKAGING docs mention
using `fetch-zig-cache.sh` but it was removed. This commit adds it back,
generating its contents from the build.zig.zon file (via zon2nix which
we use for our Nix packaging).

For packagers, there are no dependency changes: you still need Zig and
POSIX sh. For release time, Ghostty has a new dependency on `jq` but
otherwise the release process is the same. The check-zig-cache.sh script
is updated to generate the new build.zig.zon.txt file.
2025-02-14 09:23:51 -08:00
Mitchell Hashimoto
cdd287c88b Add back fetch-zig-cache.sh for packaging
See the comment on more details, which also covers when and how we can
remove this.
2025-02-14 07:23:26 -08:00
Jeffrey C. Ollie
3a8c934b19 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.
2025-02-11 08:25:34 -08:00
Mitchell Hashimoto
8bb8b01e54 build: use Zig system packaging options
This allows dynamically linking against system libraries, which is
particularly useful for packaging.
2024-10-24 14:46:37 -07:00
Jeffrey C. Ollie
21a7e40510 nix: move fetch-zig-cache script into nix/build-support 2024-09-27 20:40:03 -05:00
Jeffrey C. Ollie
a9b04037b4 nix: don't require the ZIG_LOCAL_CACHE_DIR to be set
NixOS does not set this during Nix package builds. Probably Nix's
caching got in the way of detecting this on my system.
2024-09-27 19:19:51 -05:00
Jeffrey C. Ollie
39733ac3e5 nix: work around ziglang/zig#20976 and fix nix package builds
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`.
2024-09-27 15:49:02 -05:00
Mitchell Hashimoto
8db0697b5d nix: update hash 2024-01-07 12:18:11 -08:00
RGBCube
b3082e3925 Use camelCase for all nix files 2023-12-08 16:53:02 +03:00
RGBCube
5846d991e9 Add garnix cache and clean up all nix code 2023-12-08 16:52:58 +03:00
Chris Marchesi
c3b44020f4 nix: add GitHub Actions workflow
This adds a nix workflow that does the following:

* Checks to see if the Zig cache fixed derivation needs its hash
  updated. It does this by downloading a new cache, calculating the
  hash, and comparing it against what has already been set. If the hash
  is different, the workflow fails.
* Runs a Nix build if the hash is OK, testing the build of
  packages.ghostty (using "nix build .")

The cache workflow we use in the build job comes from:
  https://github.com/DeterminateSystems/magic-nix-cache-action/

Fixes #937.
2023-11-24 17:07:55 -08:00