From 702e1826d3750e429422c07133182e9f44786832 Mon Sep 17 00:00:00 2001 From: Oleks Date: Fri, 29 May 2026 18:12:59 +0300 Subject: [PATCH] Add justfile wrapping the Nix flake build/dev/deps tasks Encodes the two flake gotchas: ?submodules=1 (submodule sources) and --builders '' (build locally instead of copying the SDK closure to nixbuild). --- justfile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 00000000..b61d84af --- /dev/null +++ b/justfile @@ -0,0 +1,45 @@ +# moonlight-android — task runner (https://github.com/casey/just) +# +# Wraps the Nix flake (devShell + hermetic nonRoot debug APK build). Two flake +# gotchas are baked in so `just ` just works: +# * `?submodules=1` — the build needs the moonlight-common-c + enet submodule +# sources, which Nix only includes when the flake is fetched with submodules. +# * `--builders ""` — force a LOCAL build. Without it the Android SDK/NDK +# closure (multi-GB) gets copied to the remote builder (eu.nixbuild.net), +# which is far slower than building here where the SDK is already realised. + +pkg := ".?submodules=1#moonlight-android" +build_flags := "--builders '' --print-build-logs" + +# list available recipes +default: + @just --list + +# enter the dev shell (JDK 17 + Android SDK 34 / NDK 27 + Gradle), then e.g. ./gradlew assembleNonRootDebug +dev: + nix develop '.?submodules=1' + +# build the nonRoot debug APK -> ./result/app-nonRoot-debug.apk +build: + nix build '{{ pkg }}' {{ build_flags }} + +# build and print the resulting APK path +apk: build + @ls -l result/app-nonRoot-debug.apk + +# install the built debug APK onto a connected device/emulator (needs adb + USB debugging) +install: build + nix run nixpkgs#android-tools -- adb install -r result/app-nonRoot-debug.apk + +# regenerate the offline Maven lockfile (deps.json) after changing dependencies +deps: + nix build '.?submodules=1#moonlight-android.mitmCache.updateScript' + ./result + +# evaluate the flake without building (catches eval errors fast) +check: + nix flake check '.?submodules=1' --no-build + +# remove the build result symlink +clean: + rm -f result