Skip to content

Commit

Permalink
ghostty: add darwin package
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarNestorov committed Dec 29, 2024
1 parent 0bc91a7 commit 67fff2f
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 38 deletions.
62 changes: 62 additions & 0 deletions pkgs/by-name/gh/ghostty/darwin.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
})
48 changes: 10 additions & 38 deletions pkgs/by-name/gh/ghostty/linux.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
pname,
version,
outputs,
meta,
lib,
stdenv,
bzip2,
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
};
})
63 changes: 63 additions & 0 deletions pkgs/by-name/gh/ghostty/package.nix
Original file line number Diff line number Diff line change
@@ -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
;
}

0 comments on commit 67fff2f

Please sign in to comment.