From 2be6de7ebd00ebe2b06d07d27540fb2032509281 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 26 Jul 2022 12:04:51 -0700 Subject: [PATCH] nix: we have a package that builds, but doesn't run --- nix/package.nix | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/nix/package.nix b/nix/package.nix index fcf447b55..d5f664266 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,6 +1,11 @@ { stdenv , lib +, autoPatchelfHook +, libGL +, libX11 , zig +, git +, makeWrapper }: stdenv.mkDerivation rec { @@ -9,22 +14,35 @@ stdenv.mkDerivation rec { src = ./..; - nativeBuildInputs = [ zig ]; + nativeBuildInputs = [ autoPatchelfHook git makeWrapper zig ]; buildInputs = []; dontConfigure = true; - # preBuild = '' - # export HOME=$TMPDIR - # ''; + buildPhase = '' + runHook preBuild + # Do nothing + runHook postBuild + ''; installPhase = '' runHook preInstall - zig build -Drelease-safe --prefix $out install + export SDK_PATH=${src}/vendor/mach-sdk + zig build -Drelease-safe \ + --cache-dir $TMP/cache \ + --global-cache-dir $TMP/global-cache \ + --prefix $out \ + install runHook postInstall ''; + postFixup = '' + wrapProgram $out/bin/ghostty \ + --prefix LD_LIBRARY_PATH : ${libGL}/lib \ + --prefix LD_LIBRARY_PATH : ${libX11}/lib + ''; + outputs = [ "out" ]; meta = with lib; {