|
6 | 6 | rustc, |
7 | 7 | cargo, |
8 | 8 | makeDesktopItem, |
9 | | -}: let |
| 9 | +}: |
| 10 | +let |
10 | 11 | pname = "defguard-client"; |
11 | 12 | version = "1.6.2"; # TODO: Get this from Cargo.toml or git |
12 | 13 |
|
|
16 | 17 | icon = pname; |
17 | 18 | desktopName = "Defguard"; |
18 | 19 | genericName = "Defguard VPN Client"; |
19 | | - categories = ["Network" "Security"]; |
| 20 | + categories = [ |
| 21 | + "Network" |
| 22 | + "Security" |
| 23 | + ]; |
20 | 24 | }; |
21 | 25 |
|
22 | 26 | pnpm = pkgs.pnpm_10; |
|
29 | 33 | gdk-pixbuf |
30 | 34 | glib |
31 | 35 | glib-networking |
32 | | - gtk4 |
| 36 | + gtk3 |
33 | 37 | harfbuzz |
34 | 38 | librsvg |
35 | 39 | libsoup_3 |
|
38 | 42 | openssl |
39 | 43 | libayatana-appindicator |
40 | 44 | desktop-file-utils |
| 45 | + iproute2 |
41 | 46 | ]; |
42 | 47 |
|
43 | 48 | nativeBuildInputs = [ |
|
55 | 60 | rustPlatform.cargoSetupHook |
56 | 61 | # helper to add dynamic library paths |
57 | 62 | pkgs.makeWrapper |
| 63 | + pkgs.wrapGAppsHook3 |
58 | 64 | ]; |
59 | 65 | in |
60 | | - stdenv.mkDerivation (finalAttrs: rec { |
61 | | - inherit pname version buildInputs nativeBuildInputs; |
62 | | - |
63 | | - src = ../.; |
64 | | - |
65 | | - # prefetch cargo dependencies |
66 | | - cargoRoot = "src-tauri"; |
67 | | - buildAndTestSubdir = "src-tauri"; |
68 | | - |
69 | | - cargoDeps = rustPlatform.importCargoLock { |
70 | | - lockFile = ../src-tauri/Cargo.lock; |
71 | | - }; |
72 | | - |
73 | | - # prefetch pnpm dependencies |
74 | | - pnpmDeps = pkgs.pnpm.fetchDeps { |
75 | | - inherit |
76 | | - (finalAttrs) |
77 | | - pname |
78 | | - version |
79 | | - src |
80 | | - ; |
81 | | - |
82 | | - fetcherVersion = 2; |
83 | | - hash = "sha256-v47yaNnt7vLDPR7WVLSonmZBBOkYWnmTUqMiPZ/WCGo="; |
84 | | - }; |
85 | | - |
86 | | - buildPhase = '' |
87 | | - pnpm tauri build |
88 | | - ''; |
89 | | - |
90 | | - postInstall = '' |
91 | | - mkdir -p $out/bin |
92 | | -
|
93 | | - # copy client binary |
94 | | - cp src-tauri/target/release/${pname} $out/bin/ |
95 | | -
|
96 | | - # copy background service binary |
97 | | - cp src-tauri/target/release/defguard-service $out/bin/ |
98 | | -
|
99 | | - # copy CLI binary |
100 | | - cp src-tauri/target/release/dg $out/bin/ |
101 | | -
|
102 | | - # add required library to client binary RPATH |
103 | | - wrapProgram $out/bin/${pname} \ |
104 | | - --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [pkgs.libayatana-appindicator pkgs.desktop-file-utils]} |
105 | | -
|
106 | | - mkdir -p $out/share/applications |
107 | | - cp ${desktopItem}/share/applications/* $out/share/applications/ |
108 | | - ''; |
109 | | - |
110 | | - meta = with lib; { |
111 | | - description = "Defguard VPN Client"; |
112 | | - homepage = "https://defguard.net"; |
113 | | - # license = licenses.gpl3Only; |
114 | | - maintainers = with maintainers; []; |
115 | | - platforms = platforms.linux; |
116 | | - }; |
117 | | - }) |
| 66 | +stdenv.mkDerivation (finalAttrs: rec { |
| 67 | + inherit |
| 68 | + pname |
| 69 | + version |
| 70 | + buildInputs |
| 71 | + nativeBuildInputs |
| 72 | + ; |
| 73 | + |
| 74 | + src = ../.; |
| 75 | + |
| 76 | + # prefetch cargo dependencies |
| 77 | + cargoRoot = "src-tauri"; |
| 78 | + buildAndTestSubdir = "src-tauri"; |
| 79 | + |
| 80 | + cargoDeps = rustPlatform.importCargoLock { |
| 81 | + lockFile = ../src-tauri/Cargo.lock; |
| 82 | + }; |
| 83 | + |
| 84 | + # prefetch pnpm dependencies |
| 85 | + pnpmDeps = pnpm.fetchDeps { |
| 86 | + inherit (finalAttrs) |
| 87 | + pname |
| 88 | + version |
| 89 | + src |
| 90 | + ; |
| 91 | + |
| 92 | + fetcherVersion = 2; |
| 93 | + hash = "sha256-Xtn0FIq097sLEl/iodLeVVOYxVLx1ePJ8UjJUmgB2f0="; |
| 94 | + }; |
| 95 | + |
| 96 | + buildPhase = '' |
| 97 | + pnpm tauri build |
| 98 | + ''; |
| 99 | + |
| 100 | + installPhase = '' |
| 101 | + mkdir -p $out/bin |
| 102 | +
|
| 103 | + # copy client binary |
| 104 | + cp src-tauri/target/release/${pname} $out/bin/ |
| 105 | +
|
| 106 | + # copy background service binary |
| 107 | + cp src-tauri/target/release/defguard-service $out/bin/ |
| 108 | +
|
| 109 | + # copy CLI binary |
| 110 | + cp src-tauri/target/release/dg $out/bin/ |
| 111 | +
|
| 112 | + # copy Tauri resources (icons for system tray, etc.) |
| 113 | + mkdir -p $out/lib/${pname} |
| 114 | + cp -r src-tauri/resources/* $out/lib/${pname}/ |
| 115 | +
|
| 116 | + mkdir -p $out/share/applications |
| 117 | + cp ${desktopItem}/share/applications/* $out/share/applications/ |
| 118 | + ''; |
| 119 | + |
| 120 | + # add extra args to wrapGAppsHook3 wrapper |
| 121 | + preFixup = '' |
| 122 | + gappsWrapperArgs+=( |
| 123 | + --prefix PATH : ${ |
| 124 | + lib.makeBinPath [ |
| 125 | + # `defguard-service` needs `ip` to manage wireguard |
| 126 | + pkgs.iproute2 |
| 127 | + # `defguard-client` needs `update-desktop-database` |
| 128 | + pkgs.desktop-file-utils |
| 129 | + ] |
| 130 | + } |
| 131 | + --prefix LD_LIBRARY_PATH : ${ |
| 132 | + lib.makeLibraryPath [ |
| 133 | + pkgs.libayatana-appindicator |
| 134 | + ] |
| 135 | + } |
| 136 | + ) |
| 137 | + ''; |
| 138 | + |
| 139 | + meta = with lib; { |
| 140 | + description = "Defguard VPN Client"; |
| 141 | + homepage = "https://defguard.net"; |
| 142 | + # license = licenses.gpl3Only; |
| 143 | + maintainers = with maintainers; [ ]; |
| 144 | + platforms = platforms.linux; |
| 145 | + }; |
| 146 | +}) |
0 commit comments