about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/terminal-emulators/wezterm/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/terminal-emulators/wezterm/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/terminal-emulators/wezterm/default.nix31
1 files changed, 26 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/applications/terminal-emulators/wezterm/default.nix b/nixpkgs/pkgs/applications/terminal-emulators/wezterm/default.nix
index 35b2500c7c97..12abd98beb48 100644
--- a/nixpkgs/pkgs/applications/terminal-emulators/wezterm/default.nix
+++ b/nixpkgs/pkgs/applications/terminal-emulators/wezterm/default.nix
@@ -1,4 +1,5 @@
-{ rustPlatform
+{ stdenv
+, rustPlatform
 , lib
 , fetchFromGitHub
 
@@ -8,6 +9,11 @@
 , openssl
 , perl
 
+# Apple frameworks
+, CoreGraphics
+, Cocoa
+, Foundation
+
 , dbus
 , libX11
 , xcbutil
@@ -25,6 +31,10 @@
 }:
 let
   runtimeDeps = [
+    zlib
+    fontconfig
+    freetype
+  ] ++ lib.optionals (stdenv.isLinux) [
     libX11
     xcbutil
     libxcb
@@ -33,13 +43,14 @@ let
     libxkbcommon
     dbus
     libglvnd
-    zlib
     egl-wayland
     wayland
     libGLU
     libGL
-    fontconfig
-    freetype
+  ] ++ lib.optionals (stdenv.isDarwin) [
+    Foundation
+    CoreGraphics
+    Cocoa
   ];
   pname = "wezterm";
 in
@@ -66,11 +77,21 @@ rustPlatform.buildRustPackage {
 
   buildInputs = runtimeDeps;
 
-  installPhase = ''
+  installPhase = "" + lib.optionalString stdenv.isLinux ''
     for artifact in wezterm wezterm-gui wezterm-mux-server strip-ansi-escapes; do
       patchelf --set-rpath "${lib.makeLibraryPath runtimeDeps}" $releaseDir/$artifact
       install -D $releaseDir/$artifact -t $out/bin
     done
+  '' + lib.optionalString stdenv.isDarwin ''
+  mkdir -p "$out/Applications"
+  OUT_APP="$out/Applications/WezTerm.app"
+  cp -r assets/macos/WezTerm.app "$OUT_APP"
+  rm $OUT_APP/*.dylib
+  cp -r assets/shell-integration/* "$OUT_APP"
+  cp $releaseDir/wezterm "$OUT_APP"
+  cp $releaseDir/wezterm-mux-server "$OUT_APP"
+  cp $releaseDir/wezterm-gui "$OUT_APP"
+  cp $releaseDir/strip-ansi-escapes "$OUT_APP"
   '';
 
   # prevent further changes to the RPATH