depot/third_party/nixpkgs/pkgs/applications/networking/twingate/default.nix
Default email 9c6ee729d6 Project import generated by Copybara.
GitOrigin-RevId: 6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222
2023-07-15 19:15:38 +02:00

54 lines
1.2 KiB
Nix

{ autoPatchelfHook
, curl
, dpkg
, dbus
, fetchurl
, lib
, libnl
, udev
, cryptsetup
, stdenv
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "twingate";
version = "1.0.60";
src = fetchurl {
url = "https://binaries.twingate.com/client/linux/DEB/${version}/twingate-amd64.deb";
sha256 = "b308c422af8a33ecd58e21a10a72c353351a189df67006e38d1ec029a93d5678";
};
buildInputs = [ dbus curl libnl udev cryptsetup ];
nativeBuildInputs = [ dpkg autoPatchelfHook ];
unpackCmd = "mkdir root ; dpkg-deb -x $curSrc root";
postPatch = ''
while read file; do
substituteInPlace "$file" \
--replace "/usr/bin" "$out/bin" \
--replace "/usr/sbin" "$out/bin"
done < <(find etc usr/lib usr/share -type f)
'';
installPhase = ''
mkdir $out
mv etc $out/
mv usr/bin $out/bin
mv usr/sbin/* $out/bin
mv usr/lib $out/lib
mv usr/share $out/share
'';
passthru.tests = { inherit (nixosTests) twingate; };
meta = with lib; {
description = "Twingate Client";
homepage = "https://twingate.com";
license = licenses.unfree;
maintainers = with maintainers; [ tonyshkurenko ];
platforms = platforms.linux;
};
}