mirror of
https://github.com/damus-io/notedeck.git
synced 2024-09-19 21:26:33 +00:00
nix: prepare targets with rust-overlay
pre-install the system-images add doc of using avd without android-studio
This commit is contained in:
parent
0e0e5d0eaa
commit
ab1e8d956c
12
README.md
12
README.md
@ -60,11 +60,23 @@ $ cargo apk run --release
|
||||
|
||||
## Android Emulator
|
||||
|
||||
With Android Studio:
|
||||
|
||||
- Install [Android Studio](https://developer.android.com/studio)
|
||||
- Open 'Device Manager' in Android Studio
|
||||
- Add a new device with API level `34` and ABI `arm64-v8a` (even though the app uses 30, the 30 emulator can't find the vulkan adapter, but 34 works fine)
|
||||
- Start up the emulator
|
||||
|
||||
Without Android Studio:
|
||||
|
||||
```sh
|
||||
# create emulator
|
||||
avdmanager create avd -k 'system-images;android-34;google_apis;arm64-v8a' -n notedeck
|
||||
|
||||
# start up the emulator
|
||||
env ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL=999 emulator -avd notedeck
|
||||
```
|
||||
|
||||
while the emulator is running, run:
|
||||
|
||||
```bash
|
||||
|
51
shell.nix
51
shell.nix
@ -1,20 +1,53 @@
|
||||
{ pkgs ? import <nixpkgs> { }
|
||||
, android ? "https://github.com/tadfisher/android-nixpkgs/archive/refs/tags/2024-04-02.tar.gz"
|
||||
{ android ? "https://github.com/tadfisher/android-nixpkgs/archive/refs/tags/2024-04-02.tar.gz"
|
||||
, use_android ? true
|
||||
, android_emulator ? false
|
||||
}:
|
||||
with pkgs;
|
||||
with import <nixpkgs>
|
||||
{
|
||||
overlays = [
|
||||
(import (builtins.fetchTarball {
|
||||
url = "https://github.com/oxalica/rust-overlay/archive/master.tar.gz";
|
||||
}))
|
||||
];
|
||||
config = {
|
||||
android_sdk.accept_license = use_android;
|
||||
allowUnfree = use_android;
|
||||
};
|
||||
};
|
||||
|
||||
let
|
||||
x11libs = lib.makeLibraryPath [ xorg.libX11 xorg.libXcursor xorg.libXrandr xorg.libXi libglvnd vulkan-loader vulkan-validation-layers libxkbcommon ];
|
||||
rustc = (rust-bin.fromRustupToolchainFile ./rust-toolchain).override {
|
||||
targets = [ ] ++
|
||||
(lib.optionals (stdenv.isLinux && use_android) [
|
||||
"aarch64-linux-android"
|
||||
]) ++
|
||||
(lib.optionals (stdenv.isLinux && stdenv.isx86_64 && use_android && android_emulator) [
|
||||
"x86_64-linux-android"
|
||||
]) ++
|
||||
(lib.optionals (stdenv.isLinux && stdenv.isx86_64) [
|
||||
"x86_64-unknown-linux-gnu"
|
||||
]) ++
|
||||
(lib.optionals (stdenv.isLinux && !stdenv.isx86_64) [
|
||||
"aarch64-unknown-linux-gnu"
|
||||
]) ++
|
||||
(lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
||||
"x86_64-apple-darwin"
|
||||
]) ++
|
||||
(lib.optionals (stdenv.isDarwin && !stdenv.isx86_64) [
|
||||
"aarch64-apple-darwin"
|
||||
])
|
||||
;
|
||||
};
|
||||
in
|
||||
mkShell ({
|
||||
nativeBuildInputs = [
|
||||
rustc
|
||||
#cargo-udeps
|
||||
#cargo-edit
|
||||
#cargo-watch
|
||||
rustup
|
||||
rustfmt
|
||||
# rustup
|
||||
# rustfmt
|
||||
libiconv
|
||||
pkg-config
|
||||
#cmake
|
||||
@ -45,13 +78,17 @@ mkShell ({
|
||||
android-nixpkgs = callPackage (fetchTarball android) { };
|
||||
ndk-version = "24.0.8215888";
|
||||
|
||||
android-sdk = android-nixpkgs.sdk (sdkPkgs: with sdkPkgs; [
|
||||
android-sdk = android-nixpkgs.sdk
|
||||
(sdkPkgs: with sdkPkgs; [
|
||||
cmdline-tools-latest
|
||||
build-tools-34-0-0
|
||||
platform-tools
|
||||
platforms-android-30
|
||||
ndk-24-0-8215888
|
||||
] ++ lib.optional android_emulator [ emulator ]);
|
||||
] ++
|
||||
(lib.optionals android_emulator [ emulator ]) ++
|
||||
(lib.optionals (android_emulator && stdenv.isx86_64) [ system-images-android-34-google-apis-x86-64 ]) ++
|
||||
(lib.optionals (android_emulator && !stdenv.isx86_64) [ system-images-android-34-google-apis-arm64-v8a ]));
|
||||
|
||||
android-sdk-path = "${android-sdk.out}/share/android-sdk";
|
||||
android-ndk-path = "${android-sdk-path}/ndk/${ndk-version}";
|
||||
|
Loading…
Reference in New Issue
Block a user