diff --git a/Makefile b/Makefile index b0fe50262..52dfca242 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,14 @@ init: git submodule update --init --recursive .PHONY: init +# Slightly cursed way that we setup a dev version of this locally on NixOS. +dev/install: + zig build -Dcpu=baseline + patchelf --set-rpath "${LD_LIBRARY_PATH}" zig-out/bin/ghostty + mkdir -p ${HOME}/bin + cp zig-out/bin/ghostty ${HOME}/bin/devtty +.PHONY: dev/install + # glad updates the GLAD loader. To use this, place the generated glad.zip # in this directory next to the Makefile, remove vendor/glad and run this target. # diff --git a/nix/devshell.nix b/nix/devshell.nix index 1ae453987..88873141a 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -22,7 +22,18 @@ , libXi , libXinerama , libXrandr -}: mkShell rec { +}: +let + # See package.nix. Keep in sync. + rpathLibs = [ + libGL + ] ++ lib.optionals stdenv.isLinux [ + libX11 + libXcursor + libXi + libXrandr + ]; +in mkShell rec { name = "ghostty"; nativeBuildInputs = [ @@ -50,5 +61,7 @@ libXrandr ]; - LD_LIBRARY_PATH = "${libX11}/lib:${libGL}/lib"; + # This should be set onto the rpath of the ghostty binary if you want + # it to be "portable" across the system. + LD_LIBRARY_PATH = lib.makeLibraryPath rpathLibs; } diff --git a/nix/package.nix b/nix/package.nix index 89522251d..97b898dad 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,3 +1,5 @@ +# TODO(mitchellh): This currenly doesn't fully work. It generates a binary +# that smashes the stack on run. I'm not sure why. { stdenv , lib , libGL