1{
2 autoPatchelfHook,
3 curl,
4 dpkg,
5 dbus,
6 fetchurl,
7 lib,
8 libnl,
9 udev,
10 cryptsetup,
11 stdenv,
12 nixosTests,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "twingate";
17 version = "2025.175.154516";
18
19 src = fetchurl {
20 url = "https://binaries.twingate.com/client/linux/DEB/x86_64/${version}/twingate-amd64.deb";
21 hash = "sha256-WqIG5AUfRxkJ1qzGs6cB/2fe/UUNOZiL5/v9QMXlmK8=";
22 };
23
24 buildInputs = [
25 dbus
26 curl
27 libnl
28 udev
29 cryptsetup
30 ];
31
32 nativeBuildInputs = [
33 dpkg
34 autoPatchelfHook
35 ];
36
37 postPatch = ''
38 while read file; do
39 substituteInPlace "$file" \
40 --replace "/usr/bin" "$out/bin" \
41 --replace "/usr/sbin" "$out/bin"
42 done < <(find etc usr/lib usr/share -type f)
43 '';
44
45 installPhase = ''
46 mkdir $out
47 mv etc $out/
48 mv usr/bin $out/bin
49 mv usr/sbin/* $out/bin
50 mv usr/lib $out/lib
51 mv usr/share $out/share
52 '';
53
54 passthru.tests = { inherit (nixosTests) twingate; };
55
56 meta = with lib; {
57 description = "Twingate Client";
58 homepage = "https://twingate.com";
59 license = licenses.unfree;
60 maintainers = with maintainers; [ tonyshkurenko ];
61 platforms = [ "x86_64-linux" ];
62 };
63}