69 Commits

Author SHA1 Message Date
Mitchell Hashimoto
f941a2185e Revert "linux: add dbus and systemd activation services (#7433)"
Reverts two commits:

977cd530c7bb9551de93900170bdaec4601b1b5b
820b7e432b57cd08c49d2e76cce4cb78016f0418

These break build from source on Linux for two reasons:

1.) The systemd user service needs to be installed in the `share`
prefix, not the `lib` prefix. This lets it get picked up in `~/.local`
but is also correct for just standard FHS paths.

2.) The `ghostty` path in the systemd user service needs to be absolute.
We should interpolate in the build install prefix to form an absolute
path.
2025-06-24 22:07:09 -04:00
Jeffrey C. Ollie
8824d11e1c linux: add dbus and systemd activation services 2025-06-13 10:22:12 -05:00
Jeffrey C. Ollie
9ad0e4675b nix: keep symbols if we're building a debug package
also add CI tests to make sure debug symbols exist

Co-authored-by: Mitchell Hashimoto <m@mitchellh.com>
2025-05-19 18:52:51 -05:00
Jeffrey C. Ollie
8d0c3c7b7c gtk: implement custom audio for bell 2025-05-13 10:01:54 -05:00
Jeffrey C. Ollie
27978ef4d0 version bump for development 2025-03-26 23:29:15 -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
Mitchell Hashimoto
b123b14686 update zig2nix 2025-03-12 15:56:24 -07:00
Leah Amelia Chen
2f65f01fc8 gtk: add localization support, take 3 (#6004)
This is my third (!) attempt at implementing localization support. By
leveraging GTK builder to do most of the `gettext` calls, I can avoid
the whole mess about missing symbols on non-glibc platforms.

Added some documentation too for contributors and translators, just for
good measure.

Supersedes #5214, resolves the GTK half of #2357
2025-03-05 20:12:52 +01:00
Leah Amelia Chen
9360afd29f gtk: add localization support, take 3
This is my third (!) attempt at implementing localization support.
By leveraging GTK builder to do most of the `gettext` calls, I
can avoid the whole mess about missing symbols on non-glibc platforms.

Added some documentation too for contributors and translators,
just for good measure.
2025-03-03 10:19:58 +01:00
Leah Amelia Chen
a85651fe4f gtk: implement quick terminal
Using `gtk4-layer-shell` still seems like the path of least resistance,
and to my delight it pretty much Just Works. Hurrah!

This implementation could do with some further polish (e.g. animations,
which can be implemented via libadwaita's animations API, and global
shortcuts), but as a MVP it works well enough.

It even supports tabs!

Fixes #4624.
2025-02-28 18:04:42 +01:00
Jeffrey C. Ollie
2ef042978d nix: include libxml2 in nativeBuildInputs for xmllint 2025-02-23 15:17:18 -06:00
Mitchell Hashimoto
52a5069dec up versions for development 2025-02-13 15:31:14 -08:00
Mitchell Hashimoto
710ea1c8d9 up all the metadata to 1.1.2 2025-02-13 13:02:06 -08:00
Jeffrey C. Ollie
f63242f7fb gtk: add support for using GTK Builder UI files and Blueprints
Adds buildtime and comptime checks to make sure that Blueprints/UI files
are availble and correctly formed. Will also compile Blueprints to UI
files so that they are available to GTK code.
2025-02-12 15:05:42 -06: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
Leah Amelia Chen
843c714088 gtk: introduce Zig bindings for GTK/GObject
`zig-gobject` is a set of GObject bindings that allow us to write
GTK-facing code in Zig instead of getting hands dirty with C.
It's been tested and refined in real-life applications and several
GTK contributors agree that it is a marked improvement over using
the C API directly, such as allowing method call syntax and avoiding
many manual `@ptrCast`s.

This commit doesn't actually contain any changes to our preexisting
GTK code — the migration process is intended to begin in chunks,
firstly in self-contained components (e.g. the header bar, overlays,
etc.), and then full-scale migration can begin when we remove non-Adwaita
GTK builds for 1.2. (After all, why port code that you'll remove later
either way?)
2025-02-10 18:34:08 +01:00
Mitchell Hashimoto
c5508e7d19 update version for development 2025-01-30 14:23:24 -08:00
Jeffrey C. Ollie
6dd9bf0038 nix: fix Ghostty homepage in package 2025-01-30 11:04:44 -06:00
Mitchell Hashimoto
adf4066b69 nix: use --system build flag instead of relying on $ZIG_GLOBAL_CACHE_DIR (#5434)
Fixes #5431
2025-01-30 08:48:31 -08:00
Jeffrey C. Ollie
40973417d0 nix: use --system build flag instead of relying on $ZIG_GLOBAL_CACHE_DIR
Fixes #5431
2025-01-30 10:16:45 -06:00
Mitchell Hashimoto
a62b26cd2f next version will be 1.1.0 2025-01-30 07:18:43 -08:00
Mitchell Hashimoto
8bf5c4ed7f This is a major refactor of build.zig.
The major idea behind the refactor is to split the `build.zig` file up into
distinct `src/build/*.zig` files. By doing so, we can improve readability of
the primary `build.zig` while also enabling better reuse of steps. Our
`build.zig` is now less than 150 lines of code (of course, it calls into a lot
more lines but they're neatly organized now).

Improvements:

  * `build.zig` is less than 150 lines of readable code.
  * Help strings and unicode table generators are only run once when multiple
    artifacts are built since the results are the same regardless of target.
  * Metal lib is only built once per architecture (rather than once per artifact)
  * Resources (shell integration, terminfo, etc.) and docs are only
    built/installed for artifacts that need them

Breaking changes:

  * Removed broken wasm build (@gabydd will re-add)
  * Removed conformance files, shell scripts are better and we don't run
    these anymore
  * Removed macOS app bundle creation, we don't use this anymore since we
    use Xcode

## Some History

Our `build.zig` hasn't been significantly refactored since the project started,
when Zig was _version 0.10_. Since then, the build system has changed
significantly. We've only ever duct taped the `build.zig` as we needed to
support new Zig versions, new features, etc. It was a mess.

The major improvement is adapting the entire Ghostty `build.zig` to the Step
and LazyPath changes introduced way back in Zig 0.12. This lets us better take
advantage of parallelism and the dependency graph so that steps are only
executed as they're needed.

As such, you can see in the build.zig that we initialize a lot of things, but
unless a final target (i.e. install, run) references those steps, _they'll
never be executed_. This lets us clean up a lot.
2025-01-07 19:47:43 -08:00
Mitchell Hashimoto
ce77b91bf6 nix fmt 2025-01-05 12:37:56 -08:00
Leah Amelia Chen
31439f311d build: add wayland 2025-01-05 12:27:11 -08:00
Mitchell Hashimoto
1d71196de3 up version to 1.0.2 for development 2024-12-31 14:12:00 -08:00
Jeffrey C. Ollie
b6e45d49a3 gtk/x11: link directly to libX11, no more dlopen 2024-12-29 01:15:01 -06:00
Jeffrey C. Ollie
8ecb11a602 gtk: add option to not link against libX11 2024-12-28 13:40:17 -06:00
Mitchell Hashimoto
35b9ceee21 up the version to 1.0.1 everywhere for dev 2024-12-26 15:21:50 -08:00
Mitchell Hashimoto
68f09eb60d set version metadata to 1.0.0 2024-12-26 11:49:31 -08:00
Jeffrey C. Ollie
b41db4f288 nix: move vimfiles instead of copying 2024-12-22 14:25:36 -06:00
Anund
ac6956f1fe nix: support programs.vim.plugins = [ ghostty.vim ]
nix vim module expects vim plugins to have their code organized as top level
directories. eg: /ftdetect rather than /share/vim/vimfiles/ftdetect. Adding
a separate output seems like a convenient way to reference the plugin
files in `programs.vim.plugins ...`. Interestingly nvim will find the
plugin via nested directories making ghostty.vim and ghostty the same
for `programs.neovim.plugins`
2024-12-19 07:21:54 -08:00
Mitchell Hashimoto
3ae3429bf7 nix: oniguruma needed for dynamic linking 2024-10-24 15:14:46 -07:00
Qwerasd
d38d0f30c4 font/sprite: replace pixman with z2d, extend Box coverage
More complete coverage of the Symbols For Legacy Computing block,
including characters from Unicode 16.0.

Pixman and the web canvas impl for Canvas have been removed in favor of
z2d for drawing, since it has a nicer API with more powerful methods,
and is in Zig with no specific platform optimizations so should compile
to wasm no problem.
2024-10-14 17:50:49 -04:00
isabel
02be641358 refactor(nix): stdenv.isX -> stdenv.hostPlatform.isX
In preparation for the deprecation of `stdenv.isX`

e0464e4788
2024-10-14 16:39:28 +01: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
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
Jeffrey C. Ollie
196c9dc3ba nix: fix up zig hook in package.nix 2024-09-26 17:24:16 -05:00
Mitchell Hashimoto
c1ead2e2f1 nix: update to zig 0.13 2024-06-24 15:16:24 -07:00
isabel
81344faeca build(nix): include more into source; ignore flake comapct 2024-06-21 18:19:14 +01:00
isabel
a73e0183d3 refactor(nix): specify source
this should reduce the amount of rebuilds that need to occur that due to
the souce changing invalidating the cache

also note that a update to nixpkgs-stable had to occur such that the new
lib functions existed
2024-06-21 15:17:43 +01:00
Jon Parise
2a66d37e48 Update functional URLs for ghostty-org 2024-06-01 16:44:09 -04:00
Jeffrey C. Ollie
bf34582f54 allow building nix package with different optimizations 2024-03-22 20:28:06 -07:00
Jeffrey C. Ollie
a69d9507b3 build ghostty nix package with ReleaseSafe 2024-03-22 20:28:06 -07:00
Lin Xianyi
6a720564b6 nix: Add meta.mainProgram 2024-01-28 10:22:38 +08:00
Jeffrey C. Ollie
ef09fa89b0 Generate documenation (manpages, etc.) from help strings. 2024-01-21 15:07:22 -06:00
Mitchell Hashimoto
d32667e46c nix: only linux is supported for the package 2024-01-20 14:23:05 -08:00
Jeffrey C. Ollie
6626c315d7 In some cases, 'self' would not be passed to the package. It's not necessary so remove it. 2024-01-06 16:30:40 -06:00
Jeffrey C. Ollie
f09901f236 Include '-nix' in the version string to distinguish Nix builds. 2024-01-06 00:08:30 -06:00
Jeffrey C. Ollie
0200f79554 Include the git commit hash in the Nix package. 2024-01-05 23:44:53 -06:00
Chris Marchesi
5704baf4e6 nix: add libX11 to RUNPATH
This adds libX11 to the (wrapped) binary RUNPATH in the Nix package
fixupPhase, to ensure that the dlopen we are doing of it now in #1193
functions correctly.

Note that we patch ".ghostty-wrapped" here, as this is now the main
binary after #1104.
2024-01-01 21:40:43 -08:00