From 0200f7955432ddcda8dc7d1c2acc583d28df54e8 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Fri, 5 Jan 2024 23:44:53 -0600 Subject: [PATCH 1/2] Include the git commit hash in the Nix package. --- flake.nix | 2 ++ nix/package.nix | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index b3bcd07c9..0536b5247 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,7 @@ }; outputs = { + self, nixpkgs-unstable, nixpkgs-stable, nixpkgs-zig-0-12, @@ -54,6 +55,7 @@ packages.${system} = rec { ghostty = pkgs-stable.callPackage ./nix/package.nix { inherit (pkgs-zig-0-12) zig_0_12; + revision = self.shortRev or self.dirtyShortRev or "dirty"; }; default = ghostty; }; diff --git a/nix/package.nix b/nix/package.nix index ea471dd0e..6b86ea75b 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,4 +1,5 @@ { + self, lib, stdenv, bzip2, @@ -23,6 +24,7 @@ ncurses, pkg-config, zig_0_12, + revision ? "dirty", }: let # The Zig hook has no way to select the release type without actual # overriding of the default flags. @@ -121,7 +123,7 @@ in dontConfigure = true; - zigBuildFlags = "-Dversion-string=${finalAttrs.version}"; + zigBuildFlags = "-Dversion-string=${finalAttrs.version}-${revision}"; preBuild = '' rm -rf $ZIG_GLOBAL_CACHE_DIR From f09901f236bc6b423f2a5e96fc674465684b81da Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sat, 6 Jan 2024 00:08:30 -0600 Subject: [PATCH 2/2] Include '-nix' in the version string to distinguish Nix builds. --- nix/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/package.nix b/nix/package.nix index 6b86ea75b..0e4d1d4b7 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -123,7 +123,7 @@ in dontConfigure = true; - zigBuildFlags = "-Dversion-string=${finalAttrs.version}-${revision}"; + zigBuildFlags = "-Dversion-string=${finalAttrs.version}-${revision}-nix"; preBuild = '' rm -rf $ZIG_GLOBAL_CACHE_DIR