32 Commits

Author SHA1 Message Date
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
Jeffrey C. Ollie
a995b6dbb0 fix nix package and add ci test for nix package build 2023-12-22 13:43:06 -06:00
Denys Pavlov
82f102224f nix: use wrapGAppsHook4 to package ghostty
`wrapGAppsHook4` is recommended by nixpkgs for packaging GTK4
applications.[1] It ensures `XDG_DATA_DIRS` includes the nescessary
icons and gsettings schemas.
2023-12-16 13:04:54 -05:00
Jeffrey C. Ollie
c4ed1f1b80 Use Alejandra to format Nix modules. 2023-12-12 11:38:39 -06:00
Jeffrey C. Ollie
bba8583a21 Add "terminfo" and "shell_integration" subpackages to the Nix package so that the Ghostty
terminfo and shell integration files can be installed on a headless server without copying all
of Ghostty to the server. Implementation liberally cribbed from the Kitty Nix package.
2023-12-12 09:30:21 -06: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
Chris Marchesi
01663c8b29 nix: update zigCacheHash, mention that building pkg requires src
This updates the zigCacheHash and just adds a note mentioning that using
the package will require you to rebuild LLVM 17 and Zig, and directs
people to use the devShell until this is resolved.

This is likely good advice for most people until such time that both are
in nixpkgs (or at least LLVM 17 as it's by far the bigger culprit here).
2023-11-21 15:59:24 -08:00
Chris Marchesi
07e16eb7c1 nix: update zigCacheHash
Just a bump to zigCacheHash to address dependency updates.
2023-11-20 23:50:31 -08:00
Chris Marchesi
fa9a6eb88d nix: use -Doptimize=ReleaseFast
I figured out how to override the hook default build flags so that we
can set -Doptimize=ReleaseFast. :)

There's a long conversation that's gone on about this in nixpkgs, but
it's fairly well summed up here:
https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653

I'd imagine we will want to adopt whatever is eventually done - after
this, we can remove the override and rely on more first-class
configuration, or logic in build.zig.
2023-11-20 21:20:38 -08:00
Chris Marchesi
2671215211 nix: fix package build
This fixes the Nix *package* build (read: not devShell, which is not
touched) so that it builds, and also conforms to what is generally seen
for a Zig project in nixpkgs.

The highlights:

* We use a Zig 0.12 derivation that I constructed from the Zig 0.11
  derivation, in addition to LLVM 17 updates found in
  NixOS/nixpkgs#258614. This specifically includes the patches that
  address ziglang/zig#15898, and also allows us to take advantage of the
  build hooks included in the Zig toolchain there.

* We pre-download the cache using "zig build --fetch" and a fixed-output
  derivation. This is similar to how the Go builders work in nixpkgs and
  I could see Zig ultimately going in a similar path, given that the
  fetcher part of the build system seems to be shaping up to having a Go
  module system-style DX (mind you, this is a naive opinion right now).

* Finally, cleaned up the derivation so that there's no special fixups
  happening outside of what is defined in the basic nixpkgs workflow.
  This is similar to other Zig projects I looked at (notably River) that
  seem to just include their dependencies in buildInputs and call it a
  day.

One specific change that is worth noting is that this changes the build
mode from ReleaseFast to ReleaseSafe - this is the current default
within the Zig build hook in nixpkgs. If we need ReleaseFast, we'll have
to override this.
2023-11-19 14:21:34 -08:00
Kevin Hovsäter
22b8173164 Fix typos 2023-08-08 14:27:34 +02:00
Mitchell Hashimoto
d114f95165 clean up some of the nix package building 2023-03-13 10:12:32 -07:00
Mitchell Hashimoto
699da6fcfe update mach 2022-10-13 11:03:23 -07:00
Mitchell Hashimoto
d614da2435 make dev/install to add a dev install 2022-07-31 16:11:01 -07:00
Mitchell Hashimoto
9779b565bf nix: add other X11 deps 2022-07-26 15:02:03 -07:00
Mitchell Hashimoto
fc611ec28b nix: update the package to set proper rpath 2022-07-26 14:39:40 -07:00
Mitchell Hashimoto
2be6de7ebd nix: we have a package that builds, but doesn't run 2022-07-26 12:04:51 -07:00
Mitchell Hashimoto
702f54a6fa first attempt at a derivation 2022-07-26 11:38:54 -07:00