depot/pkgs/by-name/wa/waveterm/package.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

194 lines
3.9 KiB
Nix

{
lib,
stdenv,
fetchurl,
makeDesktopItem,
copyDesktopItems,
unzip,
autoPatchelfHook,
atk,
at-spi2-atk,
cups,
libdrm,
gtk3,
pango,
cairo,
libX11,
libXcomposite,
libXdamage,
libXext,
libXfixes,
libXrandr,
mesa,
expat,
libxcb,
alsa-lib,
nss,
nspr,
vips,
wrapGAppsHook3,
udev,
libGL,
}:
let
pname = "waveterm";
version = "0.9.1";
src =
let
inherit (stdenv.hostPlatform) system;
selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
suffix = selectSystem {
x86_64-linux = "waveterm-linux-x64-${version}.zip";
aarch64-linux = "waveterm-linux-arm64-${version}.zip";
x86_64-darwin = "Wave-darwin-universal-${version}.zip ";
aarch64-darwin = "Wave-darwin-arm64-${version}.zip";
};
hash = selectSystem {
x86_64-linux = "sha256-DtpS9jRQljAhPA9Qcpd5acIeCyb5E/Nkyg3LXa4wrk0=";
aarch64-linux = "sha256-xM+34vsp+LFCYAFIrb0mKQRy/vPqn7FFvPlzV4JWPCg=";
x86_64-darwin = "sha256-fadf/qOec1liqpBOH+lTEGnTYJlvL8QJ3kHNcuI1wew=";
aarch64-darwin = "sha256-kKDDeIyO4CSxLWYpJyfz0Egl2S1ADRk4N/XXpsCBXVo=";
};
in
fetchurl {
url = "https://github.com/wavetermdev/waveterm/releases/download/v${version}/${suffix}";
inherit hash;
};
passthru.updateScript = ./update.sh;
desktopItems = [
(makeDesktopItem {
name = "waveterm";
exec = "waveterm --no-sandbox %U";
icon = fetchurl {
url = "https://raw.githubusercontent.com/wavetermdev/waveterm/refs/tags/v${version}/build/appicon.png";
hash = "sha256-qob27/64C9XPBtXghxg5/g0qRaiOUOpuFYL1n7/aEB0=";
};
startupWMClass = "Wave";
comment = "Open-Source AI-Native Terminal Built for Seamless Workflows";
desktopName = "Wave";
genericName = "Terminal Emulator";
categories = [
"Development"
"Utility"
"TerminalEmulator"
];
keywords = [
"developer"
"terminal"
"emulator"
];
})
];
unpackPhase = ''
runHook preUnpack
unzip ${src} -d ./
runHook postUnpack
'';
meta = {
description = "Open-source, cross-platform terminal for seamless workflows";
homepage = "https://www.waveterm.dev";
mainProgram = "waveterm";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.asl20;
platforms = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-linux"
"x86_64-darwin"
];
maintainers = with lib.maintainers; [ aucub ];
};
linux = stdenv.mkDerivation {
inherit
pname
version
src
desktopItems
unpackPhase
meta
passthru
;
nativeBuildInputs = [
unzip
copyDesktopItems
autoPatchelfHook
wrapGAppsHook3
];
buildInputs = [
atk
at-spi2-atk
cups
libdrm
gtk3
pango
cairo
libX11
libXcomposite
libXdamage
libXext
libXfixes
libXrandr
mesa
expat
libxcb
alsa-lib
nss
nspr
vips
];
runtimeDependencies = map lib.getLib [
udev
];
installPhase = ''
runHook preInstall
mkdir -p $out/waveterm $out/bin
cp -r ./* $out/waveterm/
runHook postInstall
'';
preFixup = ''
makeWrapper $out/waveterm/waveterm $out/bin/waveterm \
--prefix LD_LIBRARY_PATH : "${
lib.makeLibraryPath [
libGL
]
}"
'';
};
darwin = stdenv.mkDerivation {
inherit
pname
version
src
unpackPhase
meta
passthru
;
nativeBuildInputs = [
unzip
];
sourceRoot = "Wave.app";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications/Wave.app
cp -R . $out/Applications/Wave.app
runHook postInstall
'';
};
in
if stdenv.hostPlatform.isDarwin then darwin else linux