diff --git a/pkgs/by-name/gh/ghostty/darwin.nix b/pkgs/by-name/gh/ghostty/darwin.nix new file mode 100644 index 0000000000000..adb3ec14988e4 --- /dev/null +++ b/pkgs/by-name/gh/ghostty/darwin.nix @@ -0,0 +1,62 @@ +{ + pname, + version, + outputs, + meta, + lib, + stdenvNoCC, + fetchurl, + _7zz, + makeWrapper, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + inherit pname version outputs; + + src = fetchurl { + url = "https://release.files.ghostty.org/${finalAttrs.version}/Ghostty.dmg"; + sha256 = "sha256-CR96Kz9BYKFtfVKygiEku51XFJk4FfYqfXACeYQ3JlI="; + }; + + nativeBuildInputs = [ + _7zz + makeWrapper + ]; + + sourceRoot = "."; + installPhase = '' + runHook preInstall + + mkdir -p $out/Applications + mv Ghostty.app $out/Applications/ + makeWrapper $out/Applications/Ghostty.app/Contents/MacOS/ghostty $out/bin/ghostty + + runHook postInstall + ''; + + postFixup = + let + resources = "$out/Applications/Ghostty.app/Contents/Resources"; + in + '' + mkdir -p $man/share + ln -s ${resources}/man $man/share/man + + mkdir -p $terminfo/share + ln -s ${resources}/terminfo $terminfo/share/terminfo + + mkdir -p $shell_integration + for folder in "${resources}/ghostty/shell-integration"/*; do + ln -s $folder $shell_integration/$(basename "$folder") + done + + mkdir -p $vim + for folder in "${resources}/vim/vimfiles"/*; do + ln -s $folder $vim/$(basename "$folder") + done + ''; + + meta = meta // { + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +}) diff --git a/pkgs/by-name/gh/ghostty/linux.nix b/pkgs/by-name/gh/ghostty/linux.nix index dc5e936d2e141..662e2932d0e6c 100644 --- a/pkgs/by-name/gh/ghostty/linux.nix +++ b/pkgs/by-name/gh/ghostty/linux.nix @@ -1,4 +1,8 @@ { + pname, + version, + outputs, + meta, lib, stdenv, bzip2, @@ -43,16 +47,12 @@ let in stdenv.mkDerivation (finalAttrs: { - pname = "ghostty"; - version = "1.0.0"; - - outputs = [ - "out" - "man" - "shell_integration" - "terminfo" - "vim" - ]; + inherit + pname + version + outputs + meta + ; src = fetchFromGitHub { owner = "ghostty-org"; @@ -176,32 +176,4 @@ stdenv.mkDerivation (finalAttrs: { }; }; - meta = { - description = "Fast, native, feature-rich terminal emulator pushing modern features"; - longDescription = '' - Ghostty is a terminal emulator that differentiates itself by being - fast, feature-rich, and native. While there are many excellent terminal - emulators available, they all force you to choose between speed, - features, or native UIs. Ghostty provides all three. - ''; - homepage = "https://ghostty.org/"; - downloadPage = "https://ghostty.org/download"; - - license = lib.licenses.mit; - mainProgram = "ghostty"; - maintainers = with lib.maintainers; [ - jcollie - pluiedev - getchoo - ]; - outputsToInstall = [ - "out" - "man" - "shell_integration" - "terminfo" - ]; - platforms = lib.platforms.linux ++ lib.platforms.darwin; - # Issues finding the SDK in the sandbox - broken = stdenv.hostPlatform.isDarwin; - }; }) diff --git a/pkgs/by-name/gh/ghostty/package.nix b/pkgs/by-name/gh/ghostty/package.nix new file mode 100644 index 0000000000000..faa55c5529788 --- /dev/null +++ b/pkgs/by-name/gh/ghostty/package.nix @@ -0,0 +1,63 @@ +{ + stdenvNoCC, + callPackage, + lib, +}: + +let + pname = "ghostty"; + version = "1.0.0"; + outputs = [ + "out" + "man" + "shell_integration" + "terminfo" + "vim" + ]; + meta = { + description = "Fast, native, feature-rich terminal emulator pushing modern features"; + longDescription = '' + Ghostty is a terminal emulator that differentiates itself by being + fast, feature-rich, and native. While there are many excellent terminal + emulators available, they all force you to choose between speed, + features, or native UIs. Ghostty provides all three. + ''; + homepage = "https://ghostty.org/"; + downloadPage = "https://ghostty.org/download"; + + license = lib.licenses.mit; + mainProgram = "ghostty"; + maintainers = with lib.maintainers; [ + jcollie + pluiedev + getchoo + DimitarNestorov + ]; + outputsToInstall = [ + "out" + "man" + "shell_integration" + "terminfo" + ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +in + +if stdenvNoCC.hostPlatform.isDarwin then + callPackage ./darwin.nix { + inherit + pname + version + outputs + meta + ; + } +else + callPackage ./linux.nix { + inherit + pname + version + outputs + meta + ; + }