shell.nix (1814B)
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 wayland ]; 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 zenity 23 #gtk3 24 #gsettings-desktop-schemas 25 #brotli 26 #wabt 27 #gdb 28 #heaptrack 29 ] ++ lib.optionals use_android [ 30 jre 31 openssl 32 libiconv 33 cargo-apk 34 ] ++ lib.optional stdenv.isDarwin [ 35 darwin.apple_sdk.frameworks.Security 36 darwin.apple_sdk.frameworks.OpenGL 37 darwin.apple_sdk.frameworks.CoreServices 38 darwin.apple_sdk.frameworks.AppKit 39 ]; 40 41 } // ( 42 lib.optionalAttrs (!stdenv.isDarwin) { 43 LD_LIBRARY_PATH = "${x11libs}"; 44 #XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}"; 45 } 46 ) // ( 47 lib.optionalAttrs use_android ( 48 let 49 android-nixpkgs = callPackage (fetchTarball android) { }; 50 ndk-version = "24.0.8215888"; 51 52 android-sdk = android-nixpkgs.sdk (sdkPkgs: with sdkPkgs; [ 53 cmdline-tools-latest 54 build-tools-34-0-0 55 platform-tools 56 platforms-android-30 57 ndk-24-0-8215888 58 ] ++ lib.optional android_emulator [ emulator ]); 59 60 android-sdk-path = "${android-sdk.out}/share/android-sdk"; 61 android-ndk-path = "${android-sdk-path}/ndk/${ndk-version}"; 62 63 in 64 { 65 buildInputs = [ android-sdk ]; 66 ANDROID_NDK_ROOT = android-ndk-path; 67 } 68 ) 69 ))