Update to NixOS 24.05

Now that Namespace has support for Ubuntu 24.04 on their builders,
switch to using NixOS 24.05 as the base for building Ghostty.
This commit is contained in:
Jeffrey C. Ollie
2024-07-12 12:09:42 -05:00
parent c28470e98a
commit c25c3d8b70
7 changed files with 161 additions and 132 deletions

View File

@ -5,7 +5,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: ["namespace-profile-ghostty-md"] os: ["namespace-profile-ghostty-24-04-md"]
target: [ target: [
aarch64-linux, aarch64-linux,
@ -49,7 +49,7 @@ jobs:
build-bench: build-bench:
# We build benchmarks on large because it uses ReleaseFast # We build benchmarks on large because it uses ReleaseFast
runs-on: namespace-profile-ghostty-lg runs-on: namespace-profile-ghostty-24-04-lg
needs: test needs: test
env: env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache ZIG_LOCAL_CACHE_DIR: /zig/local-cache
@ -78,7 +78,7 @@ jobs:
run: nix develop -c zig build -Dapp-runtime=glfw -Demit-bench run: nix develop -c zig build -Dapp-runtime=glfw -Demit-bench
build-linux-libghostty: build-linux-libghostty:
runs-on: namespace-profile-ghostty-md runs-on: namespace-profile-ghostty-24-04-md
needs: test needs: test
env: env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache ZIG_LOCAL_CACHE_DIR: /zig/local-cache
@ -110,7 +110,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [namespace-profile-ghostty-md, namespace-profile-ghostty-md-arm64] os:
[
namespace-profile-ghostty-24-04-md,
namespace-profile-ghostty-24-04-arm64-md,
]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
needs: test needs: test
env: env:
@ -139,6 +143,25 @@ jobs:
- name: Test NixOS package build - name: Test NixOS package build
run: nix build .#ghostty run: nix build .#ghostty
build-nix-unstable:
runs-on: namespace-profile-ghostty-24-04-md
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
# Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: ghostty
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Test NixOS package build
run: nix build .#ghostty-unstable-releasefast
build-macos: build-macos:
runs-on: namespace-profile-ghostty-macos runs-on: namespace-profile-ghostty-macos
needs: test needs: test
@ -287,7 +310,7 @@ jobs:
run: Get-Content -Path ".\build.log" run: Get-Content -Path ".\build.log"
test: test:
runs-on: namespace-profile-ghostty-md runs-on: namespace-profile-ghostty-24-04-md
env: env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache ZIG_LOCAL_CACHE_DIR: /zig/local-cache
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
@ -343,7 +366,7 @@ jobs:
run: nix develop -c zig build test run: nix develop -c zig build test
prettier: prettier:
runs-on: namespace-profile-ghostty-sm runs-on: namespace-profile-ghostty-24-04-sm
timeout-minutes: 60 timeout-minutes: 60
env: env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache ZIG_LOCAL_CACHE_DIR: /zig/local-cache
@ -369,7 +392,7 @@ jobs:
run: nix develop -c prettier --check . run: nix develop -c prettier --check .
alejandra: alejandra:
runs-on: namespace-profile-ghostty-sm runs-on: namespace-profile-ghostty-24-04-sm
timeout-minutes: 60 timeout-minutes: 60
env: env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache ZIG_LOCAL_CACHE_DIR: /zig/local-cache

View File

@ -720,7 +720,51 @@ Below is an example:
} }
``` ```
You can also test the build of the nix package at any time by running `nix build .`. The `default` version of the Nix package builds Ghostty with NixOS 24.05.
There are many variations of the package that use different versions of NixOS
and different optimization flags to build:
| Package | NixOS version | Optimization | glibc version | GTK version | Gnome version |
| ---------------------------- | ------------- | ------------ | ------------- | ----------- | ------------- |
| ghostty-24-05-debug | 24.05 | Debug | 2.39 | 4.14 | 46 |
| ghostty-24-05-releasesafe | 24.05 | ReleaseSafe | 2.39 | 4.14 | 46 |
| ghostty-24-05-releasefast | 24.05 | ReleaseFast | 2.39 | 4.14 | 46 |
| ghostty-unstable-debug | unstable | Debug | 2.39 | 4.14 | 46 |
| ghostty-unstable-releasesafe | unstable | ReleaseSafe | 2.39 | 4.14 | 46 |
| ghostty-unstable-releasefast | unstable | ReleaseFast | 2.39 | 4.14 | 46 |
An example of how to use a non-default build of Ghostty:
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# NOTE: This will require your git SSH access to the repo.
#
# WARNING: Do NOT pin the `nixpkgs` input, as that will
# declare the cache useless. If you do, you will have
# to compile LLVM, Zig and Ghostty itself on your machine,
# which will take a very very long time.
ghostty = {
url = "git+ssh://git@github.com/ghostty-org/ghostty";
};
};
outputs = { nixpkgs, ghostty, ... }: {
nixosConfigurations.mysystem = nixpkgs.lib.nixosSystem {
modules = [
{
environment.systemPackages = [
ghostty.packages.x86_64-linux.ghostty-unstable-releasefast
];
}
];
};
};
}
```
#### Updating the Zig Cache Fixed-Output Derivation Hash #### Updating the Zig Cache Fixed-Output Derivation Hash

View File

@ -102,12 +102,12 @@ fetch(url.href)
group_add_face( group_add_face(
group, group,
0 /* regular */, 0 /* regular */,
deferred_face_new(font_name.ptr, font_name.len, 0 /* text */) deferred_face_new(font_name.ptr, font_name.len, 0 /* text */),
); );
group_add_face( group_add_face(
group, group,
0 /* regular */, 0 /* regular */,
deferred_face_new(font_name.ptr, font_name.len, 1 /* emoji */) deferred_face_new(font_name.ptr, font_name.len, 1 /* emoji */),
); );
// Initialize our sprite font, without this we just use the browser. // Initialize our sprite font, without this we just use the browser.
@ -168,7 +168,7 @@ fetch(url.href)
group_cache, group_cache,
cp, cp,
0, 0,
-1 /* best choice */ -1 /* best choice */,
); );
group_cache_render_glyph(group_cache, font_idx, cp, -1); group_cache_render_glyph(group_cache, font_idx, cp, -1);

98
flake.lock generated
View File

@ -52,24 +52,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -103,41 +85,41 @@
"url": "https://raw.githubusercontent.com/ziglang/zig/0fb2015fd3422fc1df364995f9782dfe7255eccd/doc/langref.html.in" "url": "https://raw.githubusercontent.com/ziglang/zig/0fb2015fd3422fc1df364995f9782dfe7255eccd/doc/langref.html.in"
} }
}, },
"nixpkgs-stable": { "nixpkgs-24-05": {
"locked": { "locked": {
"lastModified": 1705957679, "lastModified": 1720691131,
"narHash": "sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY=", "narHash": "sha256-CWT+KN8aTPyMIx8P303gsVxUnkinIz0a/Cmasz1jyIM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9a333eaa80901efe01df07eade2c16d183761fa3", "rev": "a046c1202e11b62cbede5385ba64908feb7bfac4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "release-23.05", "ref": "nixos-24.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1719082008, "lastModified": 1720542800,
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", "narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9693852a2070b398ee123a329e68f0dab5526681", "rev": "feb2849fdeb70028c70d73b848214b00d324a497",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-24-05": "nixpkgs-24-05",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"zig": "zig", "zig": "zig",
"zls": "zls" "zls": "zls"
@ -173,58 +155,20 @@
"type": "github" "type": "github"
} }
}, },
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"zig": { "zig": {
"inputs": { "inputs": {
"flake-compat": [], "flake-compat": "flake-compat",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"nixpkgs-stable" "nixpkgs-24-05"
] ]
}, },
"locked": { "locked": {
"lastModified": 1717848532, "lastModified": 1720786233,
"narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=", "narHash": "sha256-MW1yTbTvDSNu3LnU3rpkdaF8Xxb3D3kHqFfIerzwk98=",
"owner": "mitchellh", "owner": "mitchellh",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43", "rev": "ecfeb1f4c2970aac4a8281382ea27dbc1861c821",
"type": "github"
},
"original": {
"owner": "mitchellh",
"repo": "zig-overlay",
"type": "github"
}
},
"zig-overlay": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"zls",
"nixpkgs"
]
},
"locked": {
"lastModified": 1718539737,
"narHash": "sha256-hvQ900gSqzGnJWMRQwv65TixciIbC44iX0Nh5ENRwCU=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "6eb42ce6f85d247b1aecf854c45d80902821d0ad",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -239,16 +183,18 @@
"gitignore": "gitignore", "gitignore": "gitignore",
"langref": "langref", "langref": "langref",
"nixpkgs": [ "nixpkgs": [
"nixpkgs-stable" "nixpkgs-24-05"
], ],
"zig-overlay": "zig-overlay" "zig-overlay": [
"zig"
]
}, },
"locked": { "locked": {
"lastModified": 1718930611, "lastModified": 1720719728,
"narHash": "sha256-FtfVhs6XHNfSQRQorrrz03nD0LCNp2FCnGllRntHBts=", "narHash": "sha256-uPe4sqNB661tIi4U6YvHR9BpN8ozIcmxUJxcxI9tD1o=",
"owner": "zigtools", "owner": "zigtools",
"repo": "zls", "repo": "zls",
"rev": "0b9746b60c2020ab948f6556f1c729858b82a0f0", "rev": "b8dd9cbbcc7591159f28eb41c21315f5ef5ca995",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -2,67 +2,84 @@
description = "👻"; description = "👻";
inputs = { inputs = {
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs-24-05.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# We want to stay as up to date as possible but need to be careful that the
# 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-23.05";
zig = { zig = {
url = "github:mitchellh/zig-overlay"; url = "github:mitchellh/zig-overlay";
inputs = { inputs = {
nixpkgs.follows = "nixpkgs-stable"; nixpkgs.follows = "nixpkgs-24-05";
flake-compat.follows = "";
}; };
}; };
zls = { zls = {
url = "github:zigtools/zls/master"; url = "github:zigtools/zls/master";
inputs.nixpkgs.follows = "nixpkgs-stable"; inputs = {
nixpkgs.follows = "nixpkgs-24-05";
zig-overlay.follows = "zig";
};
}; };
}; };
outputs = { outputs = {
self, self,
nixpkgs-24-05,
nixpkgs-unstable, nixpkgs-unstable,
nixpkgs-stable,
zig, zig,
zls, zls,
...
}: }:
builtins.foldl' nixpkgs-stable.lib.recursiveUpdate {} (builtins.map (system: let builtins.foldl' nixpkgs-24-05.lib.attrsets.recursiveUpdate {} (
pkgs-stable = nixpkgs-stable.legacyPackages.${system}; builtins.map
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system}; (
in { system: let
devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix { pkgs-24-05 = import nixpkgs-24-05 {
inherit (pkgs-unstable) tracy; inherit system;
inherit (zls.packages.${system}) zls; };
pkgs-unstable = import nixpkgs-unstable {
inherit system;
};
in {
devShells.${system} = {
default = self.devShells.${system}."ghostty-24-05";
"ghostty-24-05" = pkgs-24-05.callPackage ./nix/devShell.nix {
zig_0_13 = zig.packages.${system}."0.13.0";
zls = zls.packages.${system}.zls;
wraptest = pkgs-24-05.callPackage ./nix/wraptest.nix {};
};
"ghostty-unstable" = pkgs-unstable.callPackage ./nix/devShell.nix {
zig_0_13 = zig.packages.${system}."0.13.0";
zls = zls.packages.${system}.zls;
wraptest = pkgs-24-05.callPackage ./nix/wraptest.nix {};
};
};
zig = zig.packages.${system}."0.13.0"; packages.${system} = let
wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {}; mkArgs = optimize: {
}; inherit (pkgs-unstable) zig_0_13 lib;
inherit optimize;
packages.${system} = let revision = self.shortRev or self.dirtyShortRev or "dirty";
mkArgs = optimize: { };
inherit (pkgs-unstable) zig_0_13 lib; in {
inherit optimize; default = self.packages.${system}.ghostty;
ghostty = self.packages.${system}.ghostty-releasefast;
revision = self.shortRev or self.dirtyShortRev or "dirty"; ghostty-debug = self.packages.${system}.ghostty-24-05-debug;
}; ghostty-releasesafe = self.packages.${system}.ghostty-24-05-releasesafe;
in rec { ghostty-releasefast = self.packages.${system}.ghostty-24-05-releasefast;
ghostty-debug = pkgs-stable.callPackage ./nix/package.nix (mkArgs "Debug"); ghostty-24-05-debug = pkgs-24-05.callPackage ./nix/package.nix (mkArgs "Debug");
ghostty-releasesafe = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseSafe"); ghostty-24-05-releasesafe = pkgs-24-05.callPackage ./nix/package.nix (mkArgs "ReleaseSafe");
ghostty-releasefast = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseFast"); ghostty-24-05-releasefast = pkgs-24-05.callPackage ./nix/package.nix (mkArgs "ReleaseFast");
ghostty-unstable-debug = pkgs-24-05.callPackage ./nix/package.nix (mkArgs "Debug");
ghostty = ghostty-releasefast; ghostty-unstable-releasesafe = pkgs-24-05.callPackage ./nix/package.nix (mkArgs "ReleaseSafe");
default = ghostty; ghostty-unstable-releasefast = pkgs-24-05.callPackage ./nix/package.nix (mkArgs "ReleaseFast");
}; };
formatter.${system} = pkgs-stable.alejandra;
formatter.${system} = pkgs-24-05.alejandra;
}
)
# Our supported systems are the same supported systems as the Zig binaries. # Our supported systems are the same supported systems as the Zig binaries.
}) (builtins.attrNames zig.packages)); (builtins.attrNames zig.packages)
);
nixConfig = { nixConfig = {
extra-substituters = ["https://ghostty.cachix.org"]; extra-substituters = ["https://ghostty.cachix.org"];

View File

@ -21,7 +21,7 @@
wabt, wabt,
wasmtime, wasmtime,
wraptest, wraptest,
zig, zig_0_13,
zip, zip,
zls, zls,
llvmPackages_latest, llvmPackages_latest,
@ -86,7 +86,7 @@ in
pandoc pandoc
pkg-config pkg-config
scdoc scdoc
zig zig_0_13
zip zip
# For web and wasm stuff # For web and wasm stuff
@ -99,7 +99,6 @@ in
# Testing # Testing
parallel parallel
python3 python3
tracy
vttest vttest
hyperfine hyperfine

View File

@ -34,7 +34,7 @@
# https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653 is # https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653 is
# ultimately acted on and has made its way to a nixpkgs implementation, this # ultimately acted on and has made its way to a nixpkgs implementation, this
# can probably be removed in favor of that. # can probably be removed in favor of that.
zig012Hook = zig_0_13.hook.overrideAttrs { zig_hook = zig_0_13.hook.overrideAttrs {
zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize}"; zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize}";
}; };
@ -79,7 +79,7 @@
name = "ghostty-cache"; name = "ghostty-cache";
nativeBuildInputs = [ nativeBuildInputs = [
git git
zig_0_13.hook zig_hook
]; ];
dontConfigure = true; dontConfigure = true;
@ -117,7 +117,7 @@ in
ncurses ncurses
pandoc pandoc
pkg-config pkg-config
zig012Hook zig_hook
wrapGAppsHook4 wrapGAppsHook4
]; ];