Skip to content
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

add nix #1213

Merged
merged 3 commits into from
Aug 19, 2024
Merged

add nix #1213

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
40 changes: 40 additions & 0 deletions devshell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ pkgs }:

with pkgs;

let
jdk = pkgs.jdk17;
in
with pkgs;

# Configure your development environment.
#
# Documentation: https://github.com/numtide/devshell
devshell.mkShell {
name = "branch-sdk-android";
motd = ''
Entered the Branch SDK Android development environment.
'';
env = [
{
name = "ANDROID_HOME";
value = "${android-sdk}/share/android-sdk";
}
{
name = "ANDROID_SDK_ROOT";
value = "${android-sdk}/share/android-sdk";
}
{
name = "JAVA_HOME";
value = jdk.home;
}
];
packages = [
android-sdk
jdk17 # for android build-tools
bun # faster scripting
coreutils # for date
ngrok
jq
];
}
220 changes: 220 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
description = "Branch Android SDK for deep linking and attribution";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
android.url = "github:tadfisher/android-nixpkgs";
};

outputs = { self, nixpkgs, devshell, flake-utils, android }:
{
overlay = final: prev: {
inherit (self.packages.${final.system}) android-sdk;
};
}
//
flake-utils.lib.eachSystem [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ] (system:
let
inherit (nixpkgs) lib;
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
devshell.overlays.default
self.overlay
];
};
in
{
packages = {
android-sdk = android.sdk.${system} (sdkPkgs: with sdkPkgs; [
# Useful packages for building and testing.
build-tools-34-0-0
# build-tools-30-0-3
cmdline-tools-latest
emulator
platform-tools
platforms-android-34

# Other useful packages for a development environment.
# ndk-26-1-10909125
# skiaparser-3
# sources-android-34
]
++ lib.optionals (system == "aarch64-darwin") [
system-images-android-34-google-apis-arm64-v8a
# system-images-android-34-google-apis-playstore-arm64-v8a
]
++ lib.optionals (system == "x86_64-darwin" || system == "x86_64-linux") [
system-images-android-34-google-apis-x86-64
# system-images-android-34-google-apis-playstore-x86-64
]);
} // lib.optionalAttrs (system == "x86_64-linux") {
# Android Studio in nixpkgs is currently packaged for x86_64-linux only.
# android-studio = pkgs.androidStudioPackages.stable;
# android-studio = pkgs.androidStudioPackages.beta;
# android-studio = pkgs.androidStudioPackages.preview;
# android-studio = pkgs.androidStudioPackage.canary;
};

devShell = import ./devshell.nix { inherit pkgs; };
}
);
}
Loading