nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 116 lines 3.6 kB view raw
1{ 2 lib, 3 stdenvNoCC, 4 _7zz, 5 fetchurl, 6 makeBinaryWrapper, 7}: 8 9stdenvNoCC.mkDerivation (finalAttrs: { 10 pname = "ghostty-bin"; 11 version = "1.2.3"; 12 13 src = fetchurl { 14 url = "https://release.files.ghostty.org/${finalAttrs.version}/Ghostty.dmg"; 15 hash = "sha256-817pHxFuKAJ6ufje9FCYx1dbRLQH/4g6Lc0phcSDIGs="; 16 }; 17 18 sourceRoot = "."; 19 20 # otherwise fails to unpack with: 21 # ERROR: Dangerous link path was ignored : Ghostty.app/Contents/Resources/terminfo/67/ghostty : ../78/xterm-ghostty 22 unpackPhase = lib.optionalString stdenvNoCC.hostPlatform.isDarwin '' 23 runHook preUnpack 24 7zz -snld x $src 25 runHook postUnpack 26 ''; 27 28 nativeBuildInputs = [ 29 _7zz 30 makeBinaryWrapper 31 ]; 32 33 postInstall = '' 34 mkdir -p $out/Applications 35 mv Ghostty.app $out/Applications/ 36 makeWrapper $out/Applications/Ghostty.app/Contents/MacOS/ghostty $out/bin/ghostty 37 ''; 38 39 /** 40 Ghostty really likes all of it's resources to be in the same directory, so link them back after we split them 41 42 - https://github.com/ghostty-org/ghostty/blob/4b4d4062dfed7b37424c7210d1230242c709e990/src/os/resourcesdir.zig#L11-L52 43 - https://github.com/ghostty-org/ghostty/blob/4b4d4062dfed7b37424c7210d1230242c709e990/src/termio/Exec.zig#L745-L750 44 - https://github.com/ghostty-org/ghostty/blob/4b4d4062dfed7b37424c7210d1230242c709e990/src/termio/Exec.zig#L818-L834 45 46 terminfo and shell integration should also be installable on remote machines 47 48 ```nix 49 { pkgs, ... }: { 50 environment.systemPackages = [ pkgs.ghostty.terminfo ]; 51 52 programs.bash = { 53 interactiveShellInit = '' 54 if [[ "$TERM" == "xterm-ghostty" ]]; then 55 builtin source ${pkgs.ghostty.shell_integration}/bash/ghostty.bash 56 fi 57 ''; 58 }; 59 } 60 ``` 61 62 On linux we can move the original files and make symlinks to them 63 but on darwin (when using the .app bundle) we need to copy the files 64 in order to maintain signed integrity 65 */ 66 resourceDir = "${placeholder "out"}/Applications/Ghostty.app/Contents/Resources"; 67 postFixup = '' 68 mkdir -p $terminfo/share 69 cp -r $resourceDir/terminfo $terminfo/share/terminfo 70 71 cp -r $resourceDir/ghostty/shell-integration $shell_integration 72 73 cp -r $resourceDir/vim/vimfiles $vim 74 ''; 75 76 # Usually the multiple-outputs hook would take care of this, but 77 # our manpages are in the .app bundle 78 preFixup = '' 79 mkdir -p $man/share 80 cp -r $resourceDir/man $man/share/man 81 ''; 82 83 outputs = [ 84 "out" 85 "man" 86 "shell_integration" 87 "terminfo" 88 "vim" 89 ]; 90 91 meta = { 92 description = "Fast, native, feature-rich terminal emulator pushing modern features"; 93 longDescription = '' 94 Ghostty is a terminal emulator that differentiates itself by being 95 fast, feature-rich, and native. While there are many excellent terminal 96 emulators available, they all force you to choose between speed, 97 features, or native UIs. Ghostty provides all three. 98 ''; 99 homepage = "https://ghostty.org/"; 100 downloadPage = "https://ghostty.org/download"; 101 changelog = "https://ghostty.org/docs/install/release-notes/${ 102 builtins.replaceStrings [ "." ] [ "-" ] finalAttrs.version 103 }"; 104 license = lib.licenses.mit; 105 maintainers = with lib.maintainers; [ Enzime ]; 106 mainProgram = "ghostty"; 107 outputsToInstall = [ 108 "out" 109 "man" 110 "shell_integration" 111 "terminfo" 112 ]; 113 platforms = lib.platforms.darwin; 114 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; 115 }; 116})