add a nix package (with CI tests) for libghostty-vt

This commit is contained in:
Jeffrey C. Ollie
2026-04-03 16:28:21 -05:00
parent 0790937d03
commit 4f825e87f5
3 changed files with 86 additions and 0 deletions

View File

@@ -653,6 +653,18 @@ jobs:
- name: Check to see if the binary has not been stripped
run: nm result/bin/.ghostty-wrapped 2>&1 | grep -q 'main_ghostty.main'
- name: Test ReleaseFast build of libghostty-vt
run: nix build .#libghostty-vt-releasefast
- name: Check to see if the library looks sane
run: nm result/lib/libghostty-vt.so.0.1.0 2>&1 | grep -q 'ghostty_terminal_new'
- name: Test Debug build of libghostty-vt
run: nix build .#libghostty-vt-debug
- name: Check to see if the library looks sane
run: nm result/lib/libghostty-vt.so.0.1.0 2>&1 | grep -q 'ghostty_terminal_new'
build-dist:
runs-on: namespace-profile-ghostty-sm
needs: test

View File

@@ -102,6 +102,12 @@
ghostty = ghostty-releasefast;
default = ghostty;
libghostty-vt-debug = pkgs.callPackage ./nix/libghostty-vt.nix (mkPkgArgs "Debug");
libghostty-vt-releasesafe = pkgs.callPackage ./nix/libghostty-vt.nix (mkPkgArgs "ReleaseSafe");
libghostty-vt-releasefast = pkgs.callPackage ./nix/libghostty-vt.nix (mkPkgArgs "ReleaseFast");
libghostty-vt = libghostty-vt-releasefast;
});
formatter = forAllPlatforms (pkgs: pkgs.alejandra);

68
nix/libghostty-vt.nix Normal file
View File

@@ -0,0 +1,68 @@
{
lib,
stdenv,
callPackage,
git,
pkg-config,
zig_0_15,
revision ? "dirty",
optimize ? "Debug",
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ghostty";
version = "1.3.2-dev";
# 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
#
# NOTE: as of the current moment only linux files are provided,
# since darwin support is not finished
src = lib.fileset.toSource {
root = ../.;
fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ../.)) (
lib.fileset.unions [
../dist/linux
../images
../include
../po
../pkg
../src
../vendor
../build.zig
../build.zig.zon
../build.zig.zon.nix
]
);
};
deps = callPackage ../build.zig.zon.nix {name = "ghostty-cache-${finalAttrs.version}";};
nativeBuildInputs = [
git
pkg-config
zig_0_15
];
buildInputs = [];
dontSetZigDefaultFlags = true;
zigBuildFlags = [
"--system"
"${finalAttrs.deps}"
"-Dversion-string=${finalAttrs.version}-${revision}-nix"
"-Dcpu=baseline"
"-Doptimize=${optimize}"
"-Dapp-runtime=none"
"-Demit-lib-vt=true"
];
meta = {
homepage = "https://ghostty.org";
license = lib.licenses.mit;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
})