2022-10-06 18:32:54 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, autoPatchelfHook
|
2023-03-04 12:14:45 +00:00
|
|
|
, copyDesktopItems
|
2022-10-06 18:32:54 +00:00
|
|
|
, dbus
|
2024-05-15 15:35:15 +00:00
|
|
|
, dpkg
|
|
|
|
, fetchurl
|
|
|
|
, gtk3
|
|
|
|
, libpcap
|
|
|
|
, makeDesktopItem
|
|
|
|
, makeWrapper
|
2022-10-06 18:32:54 +00:00
|
|
|
, nftables
|
|
|
|
}:
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cloudflare-warp";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2024.4.133";
|
|
|
|
|
|
|
|
suffix = {
|
|
|
|
aarch64-linux = "arm64";
|
|
|
|
x86_64-linux = "amd64";
|
|
|
|
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2024-05-15 15:35:15 +00:00
|
|
|
url = "https://pkg.cloudflareclient.com/pool/jammy/main/c/cloudflare-warp/cloudflare-warp_${version}-1_${suffix}.deb";
|
|
|
|
hash = {
|
|
|
|
aarch64-linux = "sha256-qua+aL4+yvpTBGCVUS1rzJX1KZ3DeaW9Bce9lYWvWOM=";
|
|
|
|
x86_64-linux = "sha256-xZhyYDMjcv8SLfYwclvWBqPDETbeaxiA6jFCg3Nv5gc=";
|
|
|
|
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
dpkg
|
|
|
|
autoPatchelfHook
|
2022-10-06 18:32:54 +00:00
|
|
|
makeWrapper
|
2023-03-04 12:14:45 +00:00
|
|
|
copyDesktopItems
|
2022-03-30 09:31:56 +00:00
|
|
|
];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
buildInputs = [
|
|
|
|
dbus
|
2024-05-15 15:35:15 +00:00
|
|
|
gtk3
|
|
|
|
libpcap
|
2023-04-29 16:46:19 +00:00
|
|
|
stdenv.cc.cc.lib
|
|
|
|
];
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "com.cloudflare.WarpCli";
|
|
|
|
desktopName = "Cloudflare Zero Trust Team Enrollment";
|
|
|
|
categories = [ "Utility" "Security" "ConsoleOnly" ];
|
|
|
|
noDisplay = true;
|
|
|
|
mimeTypes = [ "x-scheme-handler/com.cloudflare.warp" ];
|
|
|
|
exec = "warp-cli teams-enroll-token %u";
|
|
|
|
startupNotify = false;
|
|
|
|
terminal = true;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
autoPatchelfIgnoreMissingDeps = [
|
|
|
|
"libpcap.so.0.8"
|
|
|
|
];
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mv usr $out
|
|
|
|
mv bin $out
|
2022-10-06 18:32:54 +00:00
|
|
|
mv etc $out
|
2024-05-15 15:35:15 +00:00
|
|
|
patchelf --replace-needed libpcap.so.0.8 ${libpcap}/lib/libpcap.so $out/bin/warp-dex
|
2022-10-06 18:32:54 +00:00
|
|
|
mv lib/systemd/system $out/lib/systemd/
|
|
|
|
substituteInPlace $out/lib/systemd/system/warp-svc.service \
|
|
|
|
--replace "ExecStart=" "ExecStart=$out"
|
|
|
|
substituteInPlace $out/lib/systemd/user/warp-taskbar.service \
|
|
|
|
--replace "ExecStart=" "ExecStart=$out"
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
2022-10-06 18:32:54 +00:00
|
|
|
wrapProgram $out/bin/warp-svc --prefix PATH : ${lib.makeBinPath [ nftables ]}
|
2022-03-30 09:31:56 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Replaces the connection between your device and the Internet with a modern, optimized, protocol";
|
|
|
|
homepage = "https://pkg.cloudflareclient.com/packages/cloudflare-warp";
|
2022-06-26 10:26:21 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2022-03-30 09:31:56 +00:00
|
|
|
license = licenses.unfree;
|
2023-07-15 17:15:38 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
wolfangaukang
|
|
|
|
devpikachu
|
|
|
|
];
|
2024-05-15 15:35:15 +00:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
}
|