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).
This commit is contained in:
Oleks
2026-05-29 18:12:59 +03:00
parent f3a1cd3aef
commit 702e1826d3
+45
View File
@@ -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 <recipe>` 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