shell.nix (1578B)
1 { pkgs ? import <nixpkgs> { } 2 , android ? "https://github.com/tadfisher/android-nixpkgs/archive/refs/tags/2024-04-02.tar.gz" 3 , use_android ? true 4 , android_emulator ? false 5 }: 6 with pkgs; 7 8 let 9 x11libs = lib.makeLibraryPath [ xorg.libX11 xorg.libXcursor xorg.libXrandr xorg.libXi libglvnd vulkan-loader vulkan-validation-layers libxkbcommon ]; 10 in 11 mkShell ({ 12 nativeBuildInputs = [ 13 #cargo-udeps 14 #cargo-edit 15 #cargo-watch 16 rustup 17 rustfmt 18 libiconv 19 pkg-config 20 #cmake 21 fontconfig 22 #brotli 23 #wabt 24 #gdb 25 #heaptrack 26 ] ++ lib.optionals use_android [ 27 jre 28 openssl 29 libiconv 30 cargo-apk 31 ] ++ lib.optional stdenv.isDarwin [ 32 darwin.apple_sdk.frameworks.Security 33 darwin.apple_sdk.frameworks.OpenGL 34 darwin.apple_sdk.frameworks.CoreServices 35 darwin.apple_sdk.frameworks.AppKit 36 ]; 37 38 } // ( 39 lib.optionalAttrs (!stdenv.isDarwin) { 40 LD_LIBRARY_PATH = "${x11libs}"; 41 } 42 ) // ( 43 lib.optionalAttrs use_android ( 44 let 45 android-nixpkgs = callPackage (fetchTarball android) { }; 46 ndk-version = "24.0.8215888"; 47 48 android-sdk = android-nixpkgs.sdk (sdkPkgs: with sdkPkgs; [ 49 cmdline-tools-latest 50 build-tools-34-0-0 51 platform-tools 52 platforms-android-30 53 ndk-24-0-8215888 54 ] ++ lib.optional android_emulator [ emulator ]); 55 56 android-sdk-path = "${android-sdk.out}/share/android-sdk"; 57 android-ndk-path = "${android-sdk-path}/ndk/${ndk-version}"; 58 59 in 60 { 61 buildInputs = [ android-sdk ]; 62 ANDROID_NDK_ROOT = android-ndk-path; 63 } 64 ) 65 ))