task check works, run not.

This commit is contained in:
Thomas Güttler
2026-04-17 12:17:51 +02:00
parent 9ce598d21c
commit 6621f434fa
8 changed files with 49 additions and 14 deletions
+4
View File
@@ -8,5 +8,9 @@
# Ensures that flake.nix gets evaluated.
use flake
# Flutter via FVM — .fvmrc pins the version; fvm use creates .fvm/flutter_sdk.
# This must come after `use flake` so FVM Flutter takes precedence.
PATH_add .fvm/flutter_sdk/bin
# Load variables from .env
dotenv_if_exists
+3
View File
@@ -0,0 +1,3 @@
{
"flutter": "3.41.6"
}
+2 -3
View File
@@ -37,8 +37,7 @@ jobs:
integration:
name: Integration tests (Stalwart)
runs-on: ubuntu-latest
# Run integration tests only on push to main, not on every PR,
# since they require downloading the Stalwart binary via Nix.
# Run integration tests only on push to main, not on every PR.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
@@ -54,7 +53,7 @@ jobs:
channel: stable
cache: true
- name: Enter Nix shell and run integration tests
- name: Run integration tests
run: |
nix develop --command bash -c "
flutter pub get &&
+3
View File
@@ -51,3 +51,6 @@ linux/flutter/generated_plugins.cmake
# direnv cache
.direnv/
# FVM — .fvmrc is committed; .fvm/ contains the downloaded SDK (not committed)
.fvm/
+9 -1
View File
@@ -1,6 +1,14 @@
# Later
is there a e2e test tool in Flutter like Playwright? Application should launch, create screenshots...
Flutter best practices?
---
Flutter/Dart Linters?
---
integration_test (similar to Playwright)
---
+6 -3
View File
@@ -51,14 +51,17 @@ Run the app, tap **+**, and enter your IMAP/SMTP server details. The app syncs y
### Prerequisites
[Nix](https://nixos.org/download) with flakes enabled, and [direnv](https://direnv.net/).
[Nix](https://nixos.org/download) with flakes enabled and [direnv](https://direnv.net/).
```bash
# One-time: allow direnv in this directory
# One-time: allow direnv to load the Nix dev shell
direnv allow
# One-time: install the pinned Flutter version (fvm is provided by Nix)
fvm install
```
`direnv` loads the Nix flake automatically — no manual `nix develop` needed after that. The flake pins **Flutter 3.41.6**, Android SDK, Stalwart mail server (for integration tests), and all Linux desktop build tools (GTK3, clang, cmake).
`direnv` loads the Nix flake automatically — it provides go-task, fvm, Android SDK, Stalwart, and Linux build tools. Flutter itself is managed by FVM (pinned in `.fvmrc`) rather than Nix, which avoids glibc compatibility issues on non-NixOS hosts. `task check` also runs `fvm install` automatically if Flutter is missing.
### First-time setup
+19 -4
View File
@@ -13,10 +13,17 @@ tasks:
- sh: test "${DIRENV_DIR#-}" = "{{.TASKFILE_DIR}}"
msg: "Not in nix dev shell. Run: nix develop"
_pub-get:
_flutter-check:
internal: true
run: once
deps: [_nix-check]
cmds:
- cmd: command -v flutter >/dev/null 2>&1 || fvm install
_pub-get:
internal: true
run: once
deps: [_flutter-check]
cmds:
- flutter pub get --suppress-analytics 2>/dev/null
@@ -63,7 +70,7 @@ tasks:
integration:
desc: Integration tests against a local Stalwart mail server
deps: [_nix-check]
deps: [_flutter-check]
cmds:
- stalwart-dev/test.sh
@@ -77,18 +84,26 @@ tasks:
echo "Error: libsecret-1-dev is installed but pkg-config cannot find it."
echo "Your nix shell was opened before the package was installed."
echo "Fix: exit the nix shell and re-enter with: nix develop"
exit 1
else
echo "Error: libsecret-1-dev is not installed."
echo "Fix: sudo apt install libsecret-1-dev"
exit 1
fi
exit 1
build-linux:
desc: Build the Linux desktop app (debug)
deps: [_nix-check, _pub-get, _check-libsecret]
cmds:
- flutter build linux --debug --no-pub
- |
binary=build/linux/x64/debug/bundle/sharedinbox
missing=$(LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu ldd "$binary" 2>/dev/null | grep 'not found' || true)
if [ -n "$missing" ]; then
echo "Error: built binary has unresolvable runtime dependencies:"
echo "$missing"
echo "Fix: sudo apt install libsecret-1-0"
exit 1
fi
build-android:
desc: Build a release APK (output in build/app/outputs/flutter-apk/)
+3 -3
View File
@@ -31,9 +31,6 @@
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Flutter / Dart toolchain
flutter
# Android
androidSdk
@@ -60,6 +57,9 @@
# Task runner
go-task
# Flutter version manager (fvm install downloads the pinned Flutter SDK)
fvm
# Utilities
git
curl