lol

fluffychat: 1.7.0 -> 2.0.0

aleksana b5aec1f9 61eda88c

+209 -86
+44 -64
pkgs/by-name/fl/fluffychat/package.nix
··· 1 1 { 2 2 lib, 3 - fetchzip, 4 3 fetchFromGitHub, 5 - fetchpatch, 6 4 imagemagick, 7 5 libgbm, 8 6 libdrm, 9 7 flutter332, 10 8 pulseaudio, 9 + copyDesktopItems, 11 10 makeDesktopItem, 12 - olm, 11 + 12 + callPackage, 13 + vodozemac-wasm ? callPackage ./vodozemac-wasm.nix { flutter = flutter332; }, 13 14 14 15 targetFlutterPlatform ? "linux", 15 16 }: ··· 24 25 flutter332.buildFlutterApplication ( 25 26 rec { 26 27 pname = "fluffychat-${targetFlutterPlatform}"; 27 - version = "1.27.0"; 28 + version = "2.0.0"; 28 29 29 30 src = fetchFromGitHub { 30 31 owner = "krille-chan"; 31 32 repo = "fluffychat"; 32 33 tag = "v${version}"; 33 - hash = "sha256-kt4VpegxcZ+d0NIKan2A0AUqFLdYNcU9HY/4zyd2eSU="; 34 + hash = "sha256-fFc6nIVQUY9OiGkEc7jrzXnBQPDWC5x5A4/XHUhu6hs="; 34 35 }; 35 36 36 - # https://github.com/krille-chan/fluffychat/pull/1965 37 - patches = [ 38 - (fetchpatch { 39 - name = "fix_compilation_mxc_image.patch"; 40 - url = "https://github.com/krille-chan/fluffychat/commit/e1ec87d3aaae00eb030bcfda28ec8f247e2c3346.patch"; 41 - hash = "sha256-/cd3geNVPifAC7iTcx8V1l2WY9Y/mEw+VPl2B4HSJKY="; 42 - }) 43 - ]; 44 - 45 37 inherit pubspecLock; 46 38 47 39 gitHashes = { 48 - flutter_secure_storage_linux = "sha256-cFNHW7dAaX8BV7arwbn68GgkkBeiAgPfhMOAFSJWlyY="; 49 40 flutter_web_auth_2 = "sha256-3aci73SP8eXg6++IQTQoyS+erUUuSiuXymvR32sxHFw="; 50 41 flutter_typeahead = "sha256-ZGXbbEeSddrdZOHcXE47h3Yu3w6oV7q+ZnO6GyW7Zg8="; 42 + flutter_secure_storage_linux = "sha256-cFNHW7dAaX8BV7arwbn68GgkkBeiAgPfhMOAFSJWlyY="; 51 43 }; 52 44 53 45 inherit targetFlutterPlatform; 54 46 55 - meta = { 56 - description = "Chat with your friends (matrix client)"; 57 - homepage = "https://fluffychat.im/"; 58 - license = lib.licenses.agpl3Plus; 59 - mainProgram = "fluffychat"; 60 - maintainers = with lib.maintainers; [ 61 - mkg20001 62 - tebriel 63 - aleksana 64 - ]; 65 - platforms = [ 66 - "x86_64-linux" 67 - "aarch64-linux" 68 - ]; 69 - sourceProvenance = [ lib.sourceTypes.fromSource ]; 70 - inherit (olm.meta) knownVulnerabilities; 71 - }; 47 + meta = 48 + { 49 + description = "Chat with your friends (matrix client)"; 50 + homepage = "https://fluffychat.im/"; 51 + license = lib.licenses.agpl3Plus; 52 + maintainers = with lib.maintainers; [ 53 + mkg20001 54 + tebriel 55 + aleksana 56 + ]; 57 + badPlatforms = lib.platforms.darwin; 58 + } 59 + // lib.optionalAttrs (targetFlutterPlatform == "linux") { 60 + mainProgram = "fluffychat"; 61 + }; 72 62 } 73 63 // lib.optionalAttrs (targetFlutterPlatform == "linux") { 74 - nativeBuildInputs = [ imagemagick ]; 64 + nativeBuildInputs = [ 65 + imagemagick 66 + copyDesktopItems 67 + ]; 75 68 76 69 runtimeDependencies = [ pulseaudio ]; 77 70 78 71 env.NIX_LDFLAGS = "-rpath-link ${libwebrtcRpath}"; 79 72 80 - desktopItem = makeDesktopItem { 81 - name = "Fluffychat"; 82 - exec = "fluffychat"; 83 - icon = "fluffychat"; 84 - desktopName = "Fluffychat"; 85 - genericName = "Chat with your friends (matrix client)"; 86 - categories = [ 87 - "Chat" 88 - "Network" 89 - "InstantMessaging" 90 - ]; 91 - }; 73 + desktopItems = [ 74 + (makeDesktopItem { 75 + name = "Fluffychat"; 76 + exec = "fluffychat"; 77 + icon = "fluffychat"; 78 + desktopName = "Fluffychat"; 79 + genericName = "Chat with your friends (matrix client)"; 80 + categories = [ 81 + "Chat" 82 + "Network" 83 + "InstantMessaging" 84 + ]; 85 + }) 86 + ]; 92 87 93 88 postInstall = '' 94 89 FAV=$out/app/fluffychat-linux/data/flutter_assets/assets/favicon.png 95 90 ICO=$out/share/icons 96 91 97 - install -D $FAV $ICO/fluffychat.png 98 - mkdir $out/share/applications 99 - cp $desktopItem/share/applications/*.desktop $out/share/applications 100 92 for size in 24 32 42 64 128 256 512; do 101 - D=$ICO/hicolor/''${s}x''${s}/apps 93 + D=$ICO/hicolor/''${size}x''${size}/apps 102 94 mkdir -p $D 103 95 magick $FAV -resize ''${size}x''${size} $D/fluffychat.png 104 96 done ··· 107 99 ''; 108 100 } 109 101 // lib.optionalAttrs (targetFlutterPlatform == "web") { 110 - prePatch = 111 - # https://github.com/krille-chan/fluffychat/blob/v1.17.1/scripts/prepare-web.sh 112 - let 113 - # Use Olm 1.3.2, the oldest version, for FluffyChat 1.14.1 which depends on olm_flutter 1.2.0. 114 - olmVersion = pubspecLock.packages.flutter_olm.version; 115 - olmJs = fetchzip { 116 - url = "https://github.com/famedly/olm/releases/download/v${olmVersion}/olm.zip"; 117 - stripRoot = false; 118 - hash = "sha256-Vl3Cp2OaYzM5CPOOtTHtUb1W48VXePzOV6FeiIzyD1Y="; 119 - }; 120 - in 121 - '' 122 - rm -r assets/js/package 123 - cp -r '${olmJs}/javascript' assets/js/package 124 - ''; 102 + preBuild = '' 103 + cp -r ${vodozemac-wasm}/* ./assets/vodozemac/ 104 + ''; 125 105 } 126 106 )
+42 -22
pkgs/by-name/fl/fluffychat/pubspec.lock.json
··· 176 176 "source": "hosted", 177 177 "version": "2.1.2" 178 178 }, 179 + "build_cli_annotations": { 180 + "dependency": "transitive", 181 + "description": { 182 + "name": "build_cli_annotations", 183 + "sha256": "b59d2769769efd6c9ff6d4c4cede0be115a566afc591705c2040b707534b1172", 184 + "url": "https://pub.dev" 185 + }, 186 + "source": "hosted", 187 + "version": "2.1.0" 188 + }, 179 189 "canonical_json": { 180 190 "dependency": "transitive", 181 191 "description": { ··· 764 774 "source": "hosted", 765 775 "version": "1.1.1" 766 776 }, 767 - "flutter_olm": { 768 - "dependency": "direct main", 769 - "description": { 770 - "name": "flutter_olm", 771 - "sha256": "5e6211af8cba1abf7d1f92e543f6d573dfe6017fe4742e0d04ba84beab47f940", 772 - "url": "https://pub.dev" 773 - }, 774 - "source": "hosted", 775 - "version": "2.0.0" 776 - }, 777 777 "flutter_openssl_crypto": { 778 778 "dependency": "direct main", 779 779 "description": { ··· 793 793 }, 794 794 "source": "hosted", 795 795 "version": "2.0.28" 796 + }, 797 + "flutter_rust_bridge": { 798 + "dependency": "transitive", 799 + "description": { 800 + "name": "flutter_rust_bridge", 801 + "sha256": "b416ff56002789e636244fb4cc449f587656eff995e5a7169457eb0593fcaddb", 802 + "url": "https://pub.dev" 803 + }, 804 + "source": "hosted", 805 + "version": "2.10.0" 796 806 }, 797 807 "flutter_secure_storage": { 798 808 "dependency": "direct main", ··· 882 892 "source": "git", 883 893 "version": "5.2.0" 884 894 }, 895 + "flutter_vodozemac": { 896 + "dependency": "direct main", 897 + "description": { 898 + "name": "flutter_vodozemac", 899 + "sha256": "2405ca121b84d1cd83200a14021022e1691b123a23bcefc36adc7740cefbc1f9", 900 + "url": "https://pub.dev" 901 + }, 902 + "source": "hosted", 903 + "version": "0.2.2" 904 + }, 885 905 "flutter_web_auth_2": { 886 906 "dependency": "direct main", 887 907 "description": { ··· 1445 1465 "dependency": "direct main", 1446 1466 "description": { 1447 1467 "name": "matrix", 1448 - "sha256": "f8f78700f967de4333a0c9ca609dac2ae05914a27faa60c5530026b7aca6ae78", 1468 + "sha256": "996e3b1560959afaa3118ec2b5a06734ad29acf64f9c3c09a605c3ddef22039f", 1449 1469 "url": "https://pub.dev" 1450 1470 }, 1451 1471 "source": "hosted", 1452 - "version": "0.40.2" 1472 + "version": "1.0.1" 1453 1473 }, 1454 1474 "meta": { 1455 1475 "dependency": "transitive", ··· 1520 1540 }, 1521 1541 "source": "hosted", 1522 1542 "version": "2.0.2" 1523 - }, 1524 - "olm": { 1525 - "dependency": "transitive", 1526 - "description": { 1527 - "name": "olm", 1528 - "sha256": "6a3fe1e5170b954dd9e4ba3b27513e6aa9b7591eb7bb0d7f6f32140b7f140c6f", 1529 - "url": "https://pub.dev" 1530 - }, 1531 - "source": "hosted", 1532 - "version": "3.1.0" 1533 1543 }, 1534 1544 "opus_caf_converter_dart": { 1535 1545 "dependency": "direct main", ··· 2746 2756 }, 2747 2757 "source": "hosted", 2748 2758 "version": "15.0.0" 2759 + }, 2760 + "vodozemac": { 2761 + "dependency": "transitive", 2762 + "description": { 2763 + "name": "vodozemac", 2764 + "sha256": "dba14017e042748fb22d270e8ab1d3e46965b89788dd3857dba938ec07571968", 2765 + "url": "https://pub.dev" 2766 + }, 2767 + "source": "hosted", 2768 + "version": "0.2.0" 2749 2769 }, 2750 2770 "wakelock_plus": { 2751 2771 "dependency": "direct main",
+123
pkgs/by-name/fl/fluffychat/vodozemac-wasm.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fluffychat-web, 5 + symlinkJoin, 6 + buildPackages, 7 + rustc, 8 + rustPlatform, 9 + cargo, 10 + flutter, 11 + flutter_rust_bridge_codegen, 12 + which, 13 + wasm-pack, 14 + wasm-bindgen-cli_0_2_100, 15 + binaryen, 16 + writableTmpDirAsHomeHook, 17 + runCommand, 18 + }: 19 + 20 + let 21 + pubSources = fluffychat-web.pubspecLock.dependencySources; 22 + 23 + # wasm-pack doesn't take 'RUST_SRC_PATH' into consideration 24 + rustcWithLibSrc = buildPackages.rustc.override { 25 + sysroot = symlinkJoin { 26 + name = "rustc_unwrapped_with_libsrc"; 27 + paths = [ 28 + buildPackages.rustc.unwrapped 29 + ]; 30 + postBuild = '' 31 + mkdir -p $out/lib/rustlib/src/rust 32 + ln -s ${rustPlatform.rustLibSrc} $out/lib/rustlib/src/rust/library 33 + ''; 34 + }; 35 + }; 36 + in 37 + 38 + # https://github.com/krille-chan/fluffychat/blob/main/scripts/prepare-web.sh 39 + stdenv.mkDerivation { 40 + pname = "vodozemac-wasm"; 41 + inherit (pubSources.vodozemac) version; 42 + 43 + # These two were in the same repository, so just reuse them 44 + unpackPhase = '' 45 + runHook preUnpack 46 + 47 + cp -r ${pubSources.flutter_vodozemac}/rust ./rust 48 + cp -r ${pubSources.vodozemac} ./dart 49 + chmod -R +rwx . 50 + 51 + runHook postUnpack 52 + ''; 53 + 54 + # Remove dev_dependencies to avoid downloading them 55 + postPatch = '' 56 + sed -i '/^dev_dependencies:/,/^$/d' dart/pubspec.yaml 57 + ''; 58 + 59 + cargoRoot = "rust"; 60 + 61 + cargoDeps = symlinkJoin { 62 + name = "vodozemac-wasm-cargodeps"; 63 + paths = [ 64 + pubSources.flutter_vodozemac.passthru.cargoDeps 65 + # Pull in rust vendor so we don't have to vendor rustLibSrc again 66 + # This is required because `-Z build-std=std,panic_abort` rebuilds std 67 + rustPlatform.rustVendorSrc 68 + ]; 69 + }; 70 + 71 + nativeBuildInputs = [ 72 + rustPlatform.cargoSetupHook 73 + rustcWithLibSrc 74 + rustc.llvmPackages.lld 75 + cargo 76 + flutter 77 + flutter_rust_bridge_codegen 78 + which 79 + wasm-pack 80 + wasm-bindgen-cli_0_2_100 81 + binaryen 82 + writableTmpDirAsHomeHook 83 + ]; 84 + 85 + buildPhase = '' 86 + runHook preBuild 87 + 88 + pushd dart 89 + dart pub get --offline 90 + popd 91 + RUST_LOG=info flutter_rust_bridge_codegen build-web \ 92 + --dart-root $(realpath ./dart) --rust-root $(realpath ./rust) --release 93 + 94 + runHook postBuild 95 + ''; 96 + 97 + installPhase = '' 98 + runHook preInstall 99 + 100 + mkdir -p $out 101 + cp -r dart/web/pkg/vodozemac_bindings_dart* $out/ 102 + 103 + runHook postInstall 104 + ''; 105 + 106 + env = { 107 + # Build a pub cache from fluffychat, as dart-vodozemac should be a subset 108 + # This is required because dart-vodozemac, as a pub, doesn't have a pubspec.lock 109 + # But flutter_rust_bridge_codegen still requires all dependencies of it 110 + PUB_CACHE = runCommand "fluffychat-pub-cache" { } '' 111 + mkdir -p $out/hosted/pub.dev 112 + pushd $out/hosted/pub.dev 113 + ${lib.concatMapAttrsStringSep "; " ( 114 + _: p: 115 + "ln -s ${p} ./${if lib.hasPrefix "pub-" p.name then lib.removePrefix "pub-" p.name else p.name}" 116 + ) pubSources} 117 + popd 118 + ''; 119 + RUSTC_BOOTSTRAP = 1; # `-Z build-std=std,panic_abort` requires nightly toolchain 120 + }; 121 + 122 + inherit (fluffychat-web) meta; 123 + }