nixpkgs/pkgs/tools/networking/cloudflare-warp/default.nix
2023-04-24 17:58:30 +09:00

79 lines
1.9 KiB
Nix

{ stdenv
, lib
, fetchurl
, dpkg
, autoPatchelfHook
, makeWrapper
, copyDesktopItems
, makeDesktopItem
, dbus
, nftables
}:
stdenv.mkDerivation rec {
pname = "cloudflare-warp";
version = "2023.3.398";
src = fetchurl {
url = "https://pkg.cloudflareclient.com/uploads/cloudflare_warp_2023_3_398_1_amd64_002e48d521.deb";
hash = "sha256-1var+/G3WwICRLXsMHke277tmPYRPFW8Yf9b1Ex9OmU=";
};
nativeBuildInputs = [
dpkg
autoPatchelfHook
makeWrapper
copyDesktopItems
];
buildInputs = [
dbus
stdenv.cc.cc.lib
];
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;
})
];
unpackPhase = ''
dpkg-deb -x ${src} ./
'';
installPhase = ''
runHook preInstall
mv usr $out
mv bin $out
mv etc $out
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"
runHook postInstall
'';
postInstall = ''
wrapProgram $out/bin/warp-svc --prefix PATH : ${lib.makeBinPath [ nftables ]}
'';
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";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = with maintainers; [ wolfangaukang ];
platforms = [ "x86_64-linux" ];
};
}