23 libayatana-appindicator,
30 flutterRustBridge = rustPlatform.buildRustPackage rec {
31 pname = "flutter_rust_bridge_codegen";
32 version = "1.80.1"; # https://github.com/rustdesk/rustdesk/blob/1.3.1/.github/workflows/bridge.yml#L10
34 src = fetchFromGitHub {
36 repo = "flutter_rust_bridge";
38 hash = "sha256-SbwqWapJbt6+RoqRKi+wkSH1D+Wz7JmnVbfcfKkjt8Q=";
41 cargoHash = "sha256-dDyiptG9TKes+fXx2atwx697SWH7Rltx6xVubtTn7FM=";
44 "flutter_rust_bridge_codegen"
49 sharedLibraryExt = rustc.stdenv.hostPlatform.extensions.sharedLibrary;
52 flutter319.buildFlutterApplication rec {
55 src = fetchFromGitHub {
59 hash = "sha256-PioaSdvgJ9oXC5DAbl+em7rxcGx1om9+sjCMdrvox90=";
63 env.VCPKG_ROOT = "/homeless-shelter"; # idk man, makes the build go since https://github.com/21pages/hwcodec/commit/1873c34e3da070a462540f61c0b782b7ab15dc84
65 # Configure the Flutter/Dart build
66 sourceRoot = "${src.name}/flutter";
67 # curl https://raw.githubusercontent.com/rustdesk/rustdesk/1.3.1/flutter/pubspec.lock | yq > pubspec.lock.json
68 pubspecLock = lib.importJSON ./pubspec.lock.json;
70 dash_chat_2 = "sha256-J5Bc6CeCoRGN870aNEVJ2dkQNb+LOIZetfG2Dsfz5Ow=";
71 desktop_multi_window = "sha256-6nbOUmGTmJQx3Dr4MI6cKWwB1jEgUFUeHx24gpCkWY0=";
72 dynamic_layouts = "sha256-eFp1YVI6vI2HRgtE5nTqGZIylB226H0O8kuxy9ypuf8=";
73 flutter_gpu_texture_renderer = "sha256-0znIHlZ0ashRTev2kAXU179eq/V1RJC9Hp4jAfiPh5Q=";
74 flutter_improved_scrolling = "sha256-fKs1+JmhDVVfjyhr6Fl17pc6n++mCTjBo1PT3l/DUnc=";
75 window_manager = "sha256-CUTcSl+W7Wz/Og5k9ujOdAlhKWv/gIYe58wurf9CJH4=";
76 window_size = "sha256-+lqY46ZURT0qcqPvHFXUnd83Uvfq79Xr+rw1AHqrpak=";
79 # Configure the Rust build
81 cargoDeps = rustPlatform.importCargoLock {
82 # Upstream lock file after removing the registry variant of core-foundation-sys
83 # and fixing the resulting errors by removing the other registry deps.
84 lockFile = ./Cargo.lock;
86 "android-wakelock-0.1.0" = "sha256-09EH/U1BBs3l4galQOrTKmPUYBgryUjfc/rqPZhdYc4=";
87 "arboard-3.4.0" = "sha256-xuMfMakHVj/zjiUr6PVFy+aNQxwsXtAAFlTYxUt12fU=";
88 "cacao-0.4.0-beta2" = "sha256-U5tCLeVxjmZCm7ti1u71+i116xmozPaR69pCsA4pxrM=";
89 "clipboard-master-4.0.0-beta.6" = "sha256-GZyzGMQOZ0iwGNZa/ZzFp8gU2tQVWZBpAbim8yb6yZA=";
90 "confy-0.4.0-2" = "sha256-V7BCKISrkJIxWC3WT5+B5Vav86YTQvdO9TO6A++47FU=";
91 "core-foundation-0.9.3" = "sha256-iB4OVmWZhuWbs9RFWvNc+RNut6rip2/50o5ZM6c0c3g=";
92 "evdev-0.11.5" = "sha256-aoPmjGi/PftnH6ClEWXHvIj0X3oh15ZC1q7wPC1XPr0=";
93 "hwcodec-0.7.0" = "sha256-SswZI2BJ4pRXT379cziJlisPsc5sOiOiDqJ5WaPETnA=";
94 "impersonate_system-0.1.0" = "sha256-pIV7s2qGoCIUrhaRovBDCJaGQ/pMdJacDXJmeBpkcyI=";
95 "keepawake-0.4.3" = "sha256-cqSpkq/PCz+5+ZUyPy5hF6rP3fBzuZDywyxMUQ50Rk4=";
96 "machine-uid-0.3.0" = "sha256-rEOyNThg6p5oqE9URnxSkPtzyW8D4zKzLi9pAnzTElE=";
97 "magnum-opus-0.4.0" = "sha256-T4qaYOl8lCK1h9jWa9KqGvnVfDViT9Ob5R+YgnSw2tg=";
98 "pam-0.7.0" = "sha256-o47tVoFlW9RiL7O8Lvuwz7rMYQHO+5TG27XxkAdHEOE=";
99 "pam-sys-1.0.0-alpha4" = "sha256-5HIErVWnanLo5054NgU+DEKC2wwyiJ8AHvbx0BGbyWo=";
100 "parity-tokio-ipc-0.7.3-4" = "sha256-PKw2Twd2ap+tRrQxqg8T1FvpoeKn0hvBqn1Z44F1LcY=";
101 "rdev-0.5.0-2" = "sha256-G+PvnA5mZyN080uoI5CGj/dQ9B1J4h5iYd7214MKBR8=";
102 "reqwest-0.11.23" = "sha256-kEUT+gs4ziknDiGdPMLnj5pmxC5SBpLopZ8jZ34GDWc=";
103 "rust-pulsectl-0.2.12" = "sha256-8jXTspWvjONFcvw9/Z8C43g4BuGZ3rsG32tvLMQbtbM=";
104 "sciter-rs-0.5.57" = "sha256-5Nd9npdx8yQJEczHv7WmSmrE1lBfvp5z7BubTbYBg3E=";
105 "sysinfo-0.29.10" = "sha256-/UsFAvlWs/F7X1xT+97Fx+pnpCguoPHU3hTynqYMEs4=";
106 "tao-0.25.0" = "sha256-kLmx1z9Ybn/hDt2OcszEjtZytQIE+NKTIn9zNr9oEQk=";
107 "tfc-0.7.0" = "sha256-4plK8ttbHsBPat3/rS+4RhGzirq2Ked2wrU8cQEU1zo=";
108 "tokio-socks-0.5.2-1" = "sha256-i1dfNatqN4dinMcyAdLhj9hJWVsT10OWpCXsxl7pifI=";
109 "tray-icon-0.14.3" = "sha256-dSX7LucZaLplRrh6zLwmFzyZN4ZtwIXzAEdZzlu3gQg=";
110 "wallpaper-3.2.0" = "sha256-p9NRmusdA0wvF6onp1UTL0/4t7XnEAc19sqyGDnfg/Q=";
111 "webm-1.1.0" = "sha256-p4BMej7yvb8c/dJynRWZmwo2hxAAY96Qx6Qx2DbT8hE=";
112 "x11-2.19.0" = "sha256-GDCeKzUtvaLeBDmPQdyr499EjEfT6y4diBMzZVEptzc=";
113 "x11-clipboard-0.8.1" = "sha256-PtqmSD2MwkbLVWbfTSXZW3WEvEnUlo04qieUTjN2whE=";
116 dontCargoBuild = true;
117 cargoBuildFlags = "--lib";
118 cargoBuildType = "release";
119 cargoBuildFeatures = [
125 nativeBuildInputs = [
126 # flutter_rust_bridge_codegen
131 rustPlatform.cargoSetupHook
132 rustPlatform.cargoBuildHook
133 rustPlatform.bindgenHook
139 gst_all_1.gst-plugins-base
163 patches = [ ./make-build-reproducible.patch ];
166 substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
167 --replace-fail "libayatana-appindicator3.so.1" "${lib.getLib libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
168 substituteInPlace ../Cargo.toml --replace-fail ", \"staticlib\", \"rlib\"" ""
169 # The supplied Cargo.lock doesn't work with our fetcher so copy over the fixed version
170 cp ${./Cargo.lock} ../Cargo.lock
171 chmod +w ../Cargo.lock
175 # Disable static linking of ffmpeg since https://github.com/21pages/hwcodec/commit/1873c34e3da070a462540f61c0b782b7ab15dc84
176 sed -i 's/static=//g' /build/cargo-vendor-dir/hwcodec-*/build.rs
178 # Build the Flutter/Rust bridge bindings
179 cat <<EOF > bridge.yml
181 - "../src/flutter_ffi.rs"
183 - "./lib/generated_bridge.dart"
185 - "${lib.getLib clangStdenv.cc.cc}"
186 dart_format_line_length: 80
187 llvm_compiler_opts: "-I ${lib.getLib clangStdenv.cc.cc}/lib/clang/${lib.versions.major clangStdenv.cc.version}/include -I ${clangStdenv.cc.libc_dev}/include"
189 RUST_LOG=info ${flutterRustBridge}/bin/flutter_rust_bridge_codegen bridge.yml
191 # Build the Rust shared library
193 preBuild=() # prevent loops
195 mv ./target/*/release/liblibrustdesk${sharedLibraryExt} ./target/release/liblibrustdesk${sharedLibraryExt}
200 mkdir -p $out/share/polkit-1/actions $out/share/icons/hicolor/{256x256,scalable}/apps
201 cp ../res/128x128@2x.png $out/share/icons/hicolor/256x256/apps/rustdesk.png
202 cp ../res/scalable.svg $out/share/icons/hicolor/scalable/apps/rustdesk.svg
208 desktopName = "RustDesk";
209 genericName = "Remote Desktop";
210 comment = "Remote Desktop";
211 exec = "rustdesk %u";
214 type = "Application";
215 startupNotify = true;
221 keywords = [ "internet" ];
222 actions.new-window = {
223 name = "Open a New Window";
224 exec = "rustdesk %u";
228 name = "rustdesk-link";
229 desktopName = "RustDeskURL Scheme Handler";
231 mimeTypes = [ "x-scheme-handler/rustdesk" ];
232 tryExec = "rustdesk";
233 exec = "rustdesk %u";
236 type = "Application";
237 startupNotify = false;
242 description = "Virtual / remote desktop infrastructure for everyone! Open source TeamViewer / Citrix alternative";
243 homepage = "https://rustdesk.com";
244 license = licenses.agpl3Only;
245 maintainers = with maintainers; [ das_j ];
246 mainProgram = "rustdesk";
247 platforms = platforms.linux; # should work on darwin as well but I have no machine to test with