mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
nix: update the package to set proper rpath
This commit is contained in:
@ -1,46 +1,64 @@
|
|||||||
{ stdenv
|
{ stdenv
|
||||||
, lib
|
, lib
|
||||||
, autoPatchelfHook
|
|
||||||
, libGL
|
, libGL
|
||||||
, libX11
|
, libX11
|
||||||
|
, pkg-config
|
||||||
, zig
|
, zig
|
||||||
, git
|
, git
|
||||||
, makeWrapper
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
# These are the libraries that need to be added to the rpath for
|
||||||
|
# the binary so that they run properly on NixOS.
|
||||||
|
rpathLibs = [
|
||||||
|
libGL
|
||||||
|
] ++ lib.optionals stdenv.isLinux [
|
||||||
|
libX11
|
||||||
|
];
|
||||||
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "ghostty";
|
pname = "ghostty";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
|
|
||||||
src = ./..;
|
src = ./..;
|
||||||
|
|
||||||
nativeBuildInputs = [ autoPatchelfHook git makeWrapper zig ];
|
nativeBuildInputs = [ git pkg-config zig ];
|
||||||
|
|
||||||
buildInputs = [];
|
buildInputs = rpathLibs ++ [
|
||||||
|
# Nothing yet
|
||||||
|
];
|
||||||
|
|
||||||
dontConfigure = true;
|
dontConfigure = true;
|
||||||
|
dontPatchELF = true;
|
||||||
|
|
||||||
|
# The Zig cache goes into $HOME, so we set this to be writable
|
||||||
|
preBuild = ''
|
||||||
|
export HOME=$TMPDIR
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Build we do nothing except run hooks
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
# Do nothing
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
export SDK_PATH=${src}/vendor/mach-sdk
|
export SDK_PATH=${src}/vendor/mach-sdk
|
||||||
zig build -Drelease-safe \
|
zig build \
|
||||||
--cache-dir $TMP/cache \
|
-Dcpu=baseline \
|
||||||
--global-cache-dir $TMP/global-cache \
|
|
||||||
--prefix $out \
|
--prefix $out \
|
||||||
install
|
install
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
postFixup = ''
|
strip -S $out/bin/ghostty
|
||||||
wrapProgram $out/bin/ghostty \
|
patchelf \
|
||||||
--prefix LD_LIBRARY_PATH : ${libGL}/lib \
|
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||||
--prefix LD_LIBRARY_PATH : ${libX11}/lib
|
--set-rpath "${lib.makeLibraryPath rpathLibs}" \
|
||||||
|
$out/bin/ghostty
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" ];
|
outputs = [ "out" ];
|
||||||
|
Reference in New Issue
Block a user