From 5146c30bdb38bdfe5db2d7a86cf64bb46a26972f Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 12 Nov 2026 21:02:52 -0500 Subject: [PATCH 1/8] fix dbus config for e2e headless --- linux/nix/default.nix | 7 +++++-- linux/nix/e2e.sh | 2 +- linux/nix/screenshots.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/linux/nix/default.nix b/linux/nix/default.nix index 7e69e46..8f09dbc 100644 --- a/linux/nix/default.nix +++ b/linux/nix/default.nix @@ -65,6 +65,9 @@ apps = let buildEnv = import ./build_env.nix { inherit pkgs lib; }; + testEnv = buildEnv.env // { + DBUS_SESSION_CONFIG = "${pkgs.dbus}/share/dbus-1/session.conf"; + }; e2e = pkgs.writeShellApplication { name = "nexus-e2e"; runtimeInputs = @@ -75,7 +78,7 @@ curl dbus ]); - runtimeEnv = buildEnv.env; + runtimeEnv = testEnv; text = builtins.readFile ./e2e.sh; }; screenshots = pkgs.writeShellApplication { @@ -87,7 +90,7 @@ oxipng pngquant ]); - runtimeEnv = buildEnv.env; + runtimeEnv = testEnv; text = builtins.readFile ./screenshots.sh; }; diff --git a/linux/nix/e2e.sh b/linux/nix/e2e.sh index 6cc9f09..585712b 100755 --- a/linux/nix/e2e.sh +++ b/linux/nix/e2e.sh @@ -69,7 +69,7 @@ for file in "${files[@]}"; do name="$(basename "$file" .dart)" mkdir -p "$work/$name/data" "$work/$name/cache" XDG_DATA_HOME="$work/$name/data" XDG_CACHE_HOME="$work/$name/cache" \ - dbus-run-session -- \ + dbus-run-session --config-file="$DBUS_SESSION_CONFIG" -- \ flutter test "$file" -d linux \ --dart-define="NEXUS_E2E_HOMESERVER=$homeserver" "${flutter_args[@]}" || status=$? diff --git a/linux/nix/screenshots.sh b/linux/nix/screenshots.sh index cdf18ff..f3dced6 100644 --- a/linux/nix/screenshots.sh +++ b/linux/nix/screenshots.sh @@ -12,7 +12,7 @@ GOCACHE="$(go env GOCACHE)" export GOCACHE XDG_DATA_HOME="$work/data" XDG_CACHE_HOME="$work/cache" \ - dbus-run-session -- \ + dbus-run-session --config-file="$DBUS_SESSION_CONFIG" -- \ flutter test integration_test/screenshots/screenshots_test.dart -d linux \ --dart-define="SCREENSHOTS_DIR=$work/out" "$@" From 504b06dd029b334f64c891b90a7b7739dfb35217 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 12 Nov 2026 22:21:13 -0500 Subject: [PATCH 2/8] set NIX_CFLAGS_COMPILE explicitly to fix CI --- linux/nix/build_env.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/linux/nix/build_env.nix b/linux/nix/build_env.nix index 01b810c..9709a7a 100644 --- a/linux/nix/build_env.nix +++ b/linux/nix/build_env.nix @@ -20,13 +20,20 @@ ] ++ lib.optionals pkgs.stdenv.isLinux [ wayland - # nativeapi includes XInput2.h, which needs these, but xi.pc only lists them privately - libxext - libxfixes (callPackage ./pkg/hook_pkg_config.nix { }) ]; env = lib.optionalAttrs pkgs.stdenv.isLinux { + # nativeapi includes XInput2.h and GTK's Wayland headers, which need these, but xi.pc and gdk-3.0.pc + # only list them privately, so its hook's pkg-config doesn't return them. Hooks only get NIX_ variables. + NIX_CFLAGS_COMPILE = lib.concatMapStringsSep " " (pkg: "-isystem ${lib.getDev pkg}/include") ( + with pkgs; + [ + libxext + libxfixes + wayland + ] + ); # better_player loads libmpv at runtime to play videos LD_LIBRARY_PATH = "./build/native_assets/linux:${ lib.makeLibraryPath [ From 632be2e99bb385edf59ae589466d98d6c17db73c Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 12 Nov 2026 22:50:18 -0500 Subject: [PATCH 3/8] swap to manual versionCode for android --- android/app/build.gradle.kts | 9 +-------- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 89e537b..46feed1 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -14,13 +14,6 @@ if (keystorePropertiesFile.exists()) { } } -fun versionCodeOf(versionName: String): Int { - val parts = versionName.split("-", limit = 2) - val (major, minor, patch) = parts[0].split(".").map(String::toInt) - val preRelease = parts.getOrNull(1)?.let { Regex("\\d+").find(it)?.value?.toInt() ?: 0 } ?: 999 - return major * 100_000_000 + minor * 1_000_000 + patch * 10_000 + preRelease -} - android { namespace = "nexus.federated.nexus" compileSdk = 37 @@ -38,7 +31,7 @@ android { minSdk = 29 targetSdk = flutter.targetSdkVersion - versionCode = versionCodeOf(flutter.versionName!!) + versionCode = flutter.versionCode versionName = flutter.versionName multiDexEnabled = true diff --git a/pubspec.yaml b/pubspec.yaml index 76f274f..29c1fb8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: nexus description: "A simple and user-friendly Matrix client" -version: 1.1.1 +version: 1.1.1+101010999 publish_to: none flutter: From 861315434cea655b2ed930d1320d51f5c27e1610 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 12 Nov 2026 23:00:32 -0500 Subject: [PATCH 4/8] fixup CI vars --- linux/nix/build_env.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/linux/nix/build_env.nix b/linux/nix/build_env.nix index 9709a7a..23ca4a4 100644 --- a/linux/nix/build_env.nix +++ b/linux/nix/build_env.nix @@ -26,14 +26,16 @@ env = lib.optionalAttrs pkgs.stdenv.isLinux { # nativeapi includes XInput2.h and GTK's Wayland headers, which need these, but xi.pc and gdk-3.0.pc # only list them privately, so its hook's pkg-config doesn't return them. Hooks only get NIX_ variables. - NIX_CFLAGS_COMPILE = lib.concatMapStringsSep " " (pkg: "-isystem ${lib.getDev pkg}/include") ( - with pkgs; - [ - libxext - libxfixes - wayland - ] - ); + "NIX_CFLAGS_COMPILE_${pkgs.stdenv.cc.suffixSalt}" = + lib.concatMapStringsSep " " (pkg: "-isystem ${lib.getDev pkg}/include") + ( + with pkgs; + [ + libxext + libxfixes + wayland + ] + ); # better_player loads libmpv at runtime to play videos LD_LIBRARY_PATH = "./build/native_assets/linux:${ lib.makeLibraryPath [ From 22d615a3c8fcbc972058233e464504958d938437 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 12 Nov 2026 23:29:35 -0500 Subject: [PATCH 5/8] add gnumake to build env --- linux/nix/build_env.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux/nix/build_env.nix b/linux/nix/build_env.nix index 23ca4a4..8883959 100644 --- a/linux/nix/build_env.nix +++ b/linux/nix/build_env.nix @@ -5,6 +5,8 @@ with pkgs; [ stdenv.cc + # webcrypto's build hook runs CMake with the Unix Makefiles generator + gnumake go git ffmpeg-headless From 2b0e8fb8196a4669432171d3ef75d5ba237ae1bf Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Fri, 13 Nov 2026 00:02:22 -0500 Subject: [PATCH 6/8] add more mounted checks to room chat controller --- lib/controllers/room_chat.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/controllers/room_chat.dart b/lib/controllers/room_chat.dart index 773f30d..2a53a0d 100644 --- a/lib/controllers/room_chat.dart +++ b/lib/controllers/room_chat.dart @@ -295,6 +295,7 @@ class RoomChatController(final ChatParams info) : null, ), ); + if (!ref.mounted) return; if (response.events.isEmpty) { state = .data(chat); @@ -333,6 +334,7 @@ class RoomChatController(final ChatParams info) : chat!.historicalData!.start, ), ); + if (!ref.mounted) return; ref .read(RoomsController.provider.notifier) @@ -345,6 +347,7 @@ class RoomChatController(final ChatParams info) final rootRowId = direction == .backward ? await threadRootBefore(paginationResponse) : null; + if (!ref.mounted) return; final eventRowIds = [ ?rootRowId, ...(direction == .forward @@ -383,6 +386,7 @@ class RoomChatController(final ChatParams info) ); } } catch (_) { + if (!ref.mounted) return; state = .data(chat); rethrow; } From 262fb16e1108f4ed74d41c10aa572ad2bf4e5bf5 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Fri, 13 Nov 2026 11:24:37 -0500 Subject: [PATCH 7/8] add env helper to build hook --- hook/build.dart | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/hook/build.dart b/hook/build.dart index 8726642..ca84fda 100644 --- a/hook/build.dart +++ b/hook/build.dart @@ -64,10 +64,14 @@ Future main(List args) => build(args, (input, output) async { final targetNdkApi = codeConfig.android.targetNdkApi; + // Treats empty variables as unset, since e.g. F-Droid sets ANDROID_NDK_HOME to "" without an NDK + String? env(String name) => switch (Platform.environment[name]) { + "" => null, + final value => value, + }; + Future findNdkFromSdk() async { - final androidHome = - Platform.environment["ANDROID_HOME"] ?? - Platform.environment["ANDROID_SDK_ROOT"]; + final androidHome = env("ANDROID_HOME") ?? env("ANDROID_SDK_ROOT"); if (androidHome == null) return null; final ndkDir = Directory(join(androidHome, "ndk")); @@ -78,9 +82,9 @@ Future main(List args) => build(args, (input, output) async { } final ndkHome = - Platform.environment["ANDROID_NDK_HOME"] ?? - Platform.environment["ANDROID_NDK_ROOT"] ?? - Platform.environment["NDK_HOME"] ?? + env("ANDROID_NDK_HOME") ?? + env("ANDROID_NDK_ROOT") ?? + env("NDK_HOME") ?? await findNdkFromSdk(); if (ndkHome == null) { @@ -91,8 +95,7 @@ Future main(List args) => build(args, (input, output) async { // TODO: Someone please give me a way to detect host architecture so I can change this final hostTag = - Platform.environment["ANDROID_HOST_TAG"] ?? - "${Platform.operatingSystem}-x86_64"; + env("ANDROID_HOST_TAG") ?? "${Platform.operatingSystem}-x86_64"; final ccTriple = switch (targetArch) { Architecture.arm64 => "aarch64-linux-android", Architecture.arm => "armv7a-linux-androideabi", From 5b2700547feb886ef2feb32c39d84c5411453afd Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Fri, 13 Nov 2026 16:18:09 -0500 Subject: [PATCH 8/8] pin flutter version --- .github/workflows/ios.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/windows.yml | 2 +- pubspec.lock | 2 +- pubspec.yaml | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 28344ea..662cff6 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 3.47.4 + flutter-version-file: pubspec.yaml - name: Set up Go uses: actions/setup-go@v6 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b56f16f..5437318 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 3.47.4 + flutter-version-file: pubspec.yaml - name: Set up Go uses: actions/setup-go@v6 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d9c3402..4aa566c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 3.47.4 + flutter-version-file: pubspec.yaml - name: Set up Go uses: actions/setup-go@v6 diff --git a/pubspec.lock b/pubspec.lock index 72d5924..27a602e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1960,4 +1960,4 @@ packages: version: "2.2.4" sdks: dart: ">=3.13.3 <4.0.0" - flutter: ">=3.47.0" + flutter: "3.47.4" diff --git a/pubspec.yaml b/pubspec.yaml index 29c1fb8..aa1efbc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,8 @@ flutter: uses-material-design: true environment: - sdk: ^3.13.3 + sdk: 3.13.3 + flutter: 3.47.4 dependency_overrides: dynamic_color: 2.1.0