oncall-mobile-android/flake.nix

67 lines
1.8 KiB
Nix
Raw Normal View History

sms: relay inbound SMS to centralcloud-ops (Phase 2) Whitelisted incoming SMS are forwarded to the centralcloud-ops phone-relay endpoint as a redundant inbound path alongside Twilio. io.heckel.ntfy.sms.SmsRelayPreferences SharedPreferences-backed config — enabled flag, base URL, device id, sender whitelist (Set<String>). Strict opt-in: forward nothing unless explicitly enabled AND a non-empty whitelist matches the sender. io.heckel.ntfy.sms.SmsRelayReceiver BroadcastReceiver bound to SMS_RECEIVED_ACTION. Extracts the sender + concatenated body of multi-part SMS, applies the whitelist, and enqueues a OneTimeWorkRequest for forwarding. Wraps everything in try/catch so a failure on this hot path can never crash the device's SMS handling. io.heckel.ntfy.sms.SmsForwardWorker CoroutineWorker that POSTs to {baseUrl}/api/sms/inbound/phone-relay with X-Device-Id auth. Uses HttpUtil.defaultClient and JSONObject (no new deps). 4xx -> permanent drop, 5xx/network -> WorkManager exponential backoff retry. WorkManager constraints require a connected network so retries don't fire while offline. Manifest registration (uses-permission RECEIVE_SMS / READ_SMS, receiver declaration) is left as WIP in the working tree pending the broader managed-config / branding changes also in progress on the manifest. Commit those together (or in a follow-up) to make the receiver actually bind. No settings UI yet — set values via SharedPreferences directly or wait for the Phase 2.1 settings screen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 18:34:31 +02:00
{
description = "Nix development shell for the ntfy Android app";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils";
};
nixConfig = {
extra-substituters = [
"https://cache.centralcloud.com/default"
];
extra-trusted-public-keys = [
"default:ywfU21WX06iOn2Ec2lae1jYh4w8LO4IQkmp06vJzsk8="
];
};
outputs = {
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.android_sdk.accept_license = true;
config.allowUnfree = true;
};
androidComposition = pkgs.androidenv.composeAndroidPackages {
platformVersions = ["36"];
buildToolsVersions = ["36.0.0"];
cmdLineToolsVersion = "latest";
includeEmulator = false;
includeNDK = false;
includeSources = false;
includeSystemImages = false;
};
androidSdk = androidComposition.androidsdk;
in {
devShells.default = pkgs.mkShell {
packages = [
androidSdk
pkgs.git
pkgs.gradle
pkgs.jdk21
];
ANDROID_HOME = "${androidSdk}/libexec/android-sdk";
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
JAVA_HOME = pkgs.jdk21.home;
shellHook = ''
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"
echo "ntfy Android development shell"
echo " java : $(java -version 2>&1 | head -n 1)"
echo " ANDROID_HOME: $ANDROID_HOME"
echo ""
echo "Useful checks:"
echo " ./gradlew tasks"
echo " ./gradlew :app:assembleFdroidDebug"
'';
};
});
}