forked from tadfisher/android-nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
87 lines (76 loc) · 2.13 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
description = "Packages for Android development";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, devshell, flake-utils }:
let
sdkPkgsFor = pkgs: import ./default.nix {
inherit pkgs;
channel = builtins.readFile ./channel;
};
in
{
hmModules.android = import ./hm-module.nix;
hmModule = self.hmModules.android;
overlays.default = final: prev:
let
android = sdkPkgsFor final;
in
{
androidSdkPackages = android.packages;
androidSdk = android.sdk;
};
templates.default = {
path = ./template;
description = "Android application or library";
};
}
//
flake-utils.lib.eachSystem [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
overlays = [
(devshell.overlay)
(self.overlay)
];
allowInsecurePredicate = pkg: pkg.pname == "python";
};
};
sdkPkgs = sdkPkgsFor pkgs;
in
{
inherit (sdkPkgs) sdk;
apps = {
format = {
type = "app";
program = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt";
};
};
checks = {
lint = with pkgs; runCommandLocal "lint" { } ''
cd ${./.}
${nixpkgs-fmt}/bin/nixpkgs-fmt --check *.nix pkgs/android/*.nix template/*.nix nix-android-repo/*.nix
echo "checked" > $out
'';
sdk = self.sdk.${system} (sdkPkgs: with sdkPkgs; [
cmdline-tools-latest
build-tools-34-0-0
emulator
ndk-26-1-10909125
platform-tools
platforms-android-34
tools
]);
};
packages = flake-utils.lib.flattenTree sdkPkgs.packages;
});
}