Skip to content

Instantly share code, notes, and snippets.

@wochap
Created June 24, 2021 15:28
Show Gist options
  • Save wochap/559432a54d3a74319a540fd1b3615ed6 to your computer and use it in GitHub Desktop.
Save wochap/559432a54d3a74319a540fd1b3615ed6 to your computer and use it in GitHub Desktop.
React native nix shell config example
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
android = import (builtins.fetchTarball {
url = https://github.com/tadfisher/android-nixpkgs/archive/0c4e5a01dbd4c8c894f2186a7c582abf55a43c5e.tar.gz;
sha256 = "0x56nh4nxx5hvpi7aq66v7xm9mzn4b2gs50z60w8c3ciimjlpip8";
}) {
channel = "stable";
};
androidSdkPackages = android;
androidSdk = androidSdkPackages.sdk (sdkPkgs: with sdkPkgs; [
cmdline-tools-latest
build-tools-29-0-2
build-tools-30-0-3
platform-tools
platforms-android-29
emulator
]);
in
mkShell {
name = "rn-test";
buildInputs = [
watchman
jdk8
android-studio
androidSdk
nodejs-14_x
(yarn.override { nodejs = nodejs-14_x; })
];
shellHook = ''
export JAVA_HOME="${jdk8.home}"
'';
# override the aapt2 that gradle uses with the nix-shipped version
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/share/android-sdk/build-tools/30.0.3/aapt2";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment