New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
androidenv: android licenses #67661
androidenv: android licenses #67661
Conversation
who would be right person to check here? |
mkdir $out/licenses | ||
${builtins.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (k: v: "echo -e '\n${v}' > $out/licenses/${k}") licenses))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what is your use case. I have spent some time this week playing with this PR trying to run a React Native project. In the end it turned out that for my project I didn't need any special license, it was enough with config.android_sdk.accept_license = true
.
In any case, when using this branch I realized that the licenses
folder is created in the root of the package. However, the SDK is inside libexec/android-sdk
so there is no way to configure $ANDROID_HOME
so both the licenses and the tools are found. I think that the licenses
folder should be inside the SDK folder.
- mkdir $out/licenses
- ${builtins.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (k: v: "echo -e '\n${v}' > $out/licenses/${k}") licenses))}
+ ${builtins.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (k: v: "echo -e '\n${v}' > $out/libexec/sdk-manager/licenses/${k}") licenses))}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dicearr I didn't manage to work my react-native with that, but I found adding this license stuff just progressed me a little further so wanted to share. I didn't try accept_licnese though.
Would you mind sharing your setup for local dev / emulator and releasing process? Currently I'm using docker with openjdk to provide this environments as I didn't mange to do it in Nix, I emulator from nix though.
If you have this working I would be happy to document it and put in NixOS docs as this stuff is not very well described.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a run-android.nix
file which is a combination of the android documentation with #72220 (comment). Executing $ nix-shell run-android.nix
should make the application run in the device/emulator.
with import <nixpkgs> {
config.android_sdk.accept_license = true;
};
let androidComposition = androidenv.composeAndroidPackages {
toolsVersion = "25.2.5";
platformVersions = [ "28" ];
};
in (buildFHSUserEnv {
name = "react-native-env";
targetPkgs = pkgs: ([
androidComposition.androidsdk
glibc
openjdk
nodejs-12_x
]);
runScript = ''
;ANDROID_HOME=${androidComposition.androidsdk}/libexec/android-sdk \
$(npm bin)/react-native run-android
'';
})
.env
cc @svanderburg |
@spinus @svanderburg Is this PR still applicable - or does the user approval via @spinus Your insight may help in PR #82118 - where I update the package-related generated expressions. Would you please consider having a look at that PR, and prepare a branch for any changes you may envisage. Thanks! |
@lucafavatella sorry for delay. I've seen your PR but I was not skilled yet with it to provide constructive feedback. Thank for pushing this. Looks like good chunk of work, I guess I'm closing this one in that case. Cheers. |
Motivation for this change
Android SDK requires accepted licenses, those are save in specific location and looks like android tools construct paths based on their location, rather than env variables (which means they are looking in nix store and user is not able to add them setting environment variable [at least I didn't find how to do it]).
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @svanderburg