15 stdenv.mkDerivation rec {
23 rev = "refs/tags/v${version}";
24 hash = "sha256-PL/UvRNqvLaFuvSHbkJsaJ2nqRp5+ERM+rmlKVtbShk=";
25 fetchSubmodules = true;
29 GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
30 GIT_CONFIG_VALUE_0 = "git@github.com:";
34 # remove vendored ffmpeg, adb and scrcpy-server
35 ./remove_vendors.patch
37 # remove predefined adb and scrcpy-server path
38 # we later set them in wrapper
39 ./remove_predefined_paths.patch
41 # remove avcodec_close which is deprecated in ffmpeg_7
42 # This doesn't affect functionality because
43 # it's followed by avcodec_free_context
44 ./remove_deprecated_avcodec_free_context.patch
48 substituteInPlace QtScrcpy/QtScrcpyCore/{include/QtScrcpyCoreDef.h,src/device/server/server.h} \
49 --replace-fail 'serverVersion = "2.1.1"' 'serverVersion = "${scrcpy.version}"'
50 substituteInPlace QtScrcpy/util/config.cpp \
51 --replace-fail 'COMMON_SERVER_VERSION_DEF "2.1.1"' 'COMMON_SERVER_VERSION_DEF "${scrcpy.version}"'
52 substituteInPlace QtScrcpy/audio/audiooutput.cpp \
53 --replace-fail 'sndcpy.sh' "$out/share/qtscrcpy/sndcpy.sh"
54 substituteInPlace QtScrcpy/sndcpy/sndcpy.sh \
55 --replace-fail 'ADB=./adb' "ADB=${lib.getExe' android-tools "adb"}" \
56 --replace-fail 'SNDCPY_APK=sndcpy.apk' "SNDCPY_APK=$out/share/qtscrcpy/sndcpy.apk"
62 libsForQt5.wrapQtAppsHook
69 # Upstream vendors ffmpeg_4
72 ++ (with libsForQt5; [
78 env.NIX_CFLAGS_COMPILE = toString [
79 "-Wno-error=sign-compare"
82 # Doesn't contain rule to install
86 pushd ../output/x64/Release
87 install -Dm755 QtScrcpy -t $out/bin
88 install -Dm755 sndcpy.sh -t $out/share/qtscrcpy
89 install -Dm644 sndcpy.apk -t $out/share/qtscrcpy
92 install -Dm644 ../QtScrcpy/res/image/tray/logo.png $out/share/pixmaps/qtscrcpy.png
100 exec = "QtScrcpy %U";
102 desktopName = "QtScrcpy";
103 genericName = "Android Display Control";
113 --set QTSCRCPY_ADB_PATH ${lib.getExe' android-tools "adb"}
114 --set QTSCRCPY_SERVER_PATH ${scrcpy}/share/scrcpy/scrcpy-server
119 description = "Android real-time display control software";
120 homepage = "https://github.com/barry-ran/QtScrcpy";
121 license = lib.licenses.asl20;
122 maintainers = with lib.maintainers; [
126 mainProgram = "QtScrcpy";
127 platforms = with lib.platforms; linux ++ darwin ++ windows;
128 # needs some special handling on darwin as it generates .app bundle directly
129 badPlatforms = lib.platforms.darwin;
130 sourceProvenance = with lib.sourceTypes; [
132 # Still includes sndcpy.apk vendored in the same repo
133 # which will run on controlled Android device
134 # https://github.com/barry-ran/QtScrcpy/blob/master/QtScrcpy/sndcpy/sndcpy.apk