1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
{ lib
, stdenvNoCC
, stdenv
, fetchurl
, autoPatchelfHook
, undmg
, zstd
, curl
, fontconfig
, libglvnd
, libxkbcommon
, vulkan-loader
, wayland
, xdg-utils
, xorg
, zlib
, makeWrapper
, waylandSupport ? false
}:
let
pname = "warp-terminal";
versions = lib.importJSON ./versions.json;
passthru.updateScript = ./update.sh;
linux_arch =
if stdenv.hostPlatform.system == "x86_64-linux"
then "x86_64"
else "aarch64";
linux = stdenv.mkDerivation (finalAttrs: {
inherit pname meta passthru;
inherit (versions."linux_${linux_arch}") version;
src = fetchurl {
inherit (versions."linux_${linux_arch}") hash;
url = "https://releases.warp.dev/stable/v${finalAttrs.version}/warp-terminal-v${finalAttrs.version}-1-${linux_arch}.pkg.tar.zst";
};
sourceRoot = ".";
postPatch = ''
substituteInPlace usr/bin/warp-terminal \
--replace-fail /opt/ $out/opt/
'';
nativeBuildInputs = [ autoPatchelfHook zstd makeWrapper ];
buildInputs = [
curl
fontconfig
stdenv.cc.cc.lib # libstdc++.so libgcc_s.so
zlib
];
runtimeDependencies = [
libglvnd # for libegl
libxkbcommon
stdenv.cc.libc
vulkan-loader
xdg-utils
xorg.libX11
xorg.libxcb
xorg.libXcursor
xorg.libXi
] ++ lib.optionals waylandSupport [wayland];
installPhase = ''
runHook preInstall
mkdir $out
cp -r opt usr/* $out
'' + lib.optionalString waylandSupport ''
wrapProgram $out/bin/warp-terminal --set WARP_ENABLE_WAYLAND 1
'' + ''
runHook postInstall
'';
});
darwin = stdenvNoCC.mkDerivation (finalAttrs: {
inherit pname meta passthru;
inherit (versions.darwin) version;
src = fetchurl {
inherit (versions.darwin) hash;
url = "https://releases.warp.dev/stable/v${finalAttrs.version}/Warp.dmg";
};
sourceRoot = ".";
nativeBuildInputs = [ undmg ];
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r *.app $out/Applications
runHook postInstall
'';
});
meta = with lib; {
description = "Rust-based terminal";
homepage = "https://www.warp.dev";
license = licenses.unfree;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ emilytrau imadnyc donteatoreo johnrtitor ];
platforms = platforms.darwin ++ [ "x86_64-linux" "aarch64-linux" ];
};
in
if stdenvNoCC.hostPlatform.isDarwin
then darwin
else linux
|