-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnix-android.nix
More file actions
68 lines (65 loc) · 1.82 KB
/
Copy pathnix-android.nix
File metadata and controls
68 lines (65 loc) · 1.82 KB
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
# Wire [nix-android](https://github.com/devindudeman/nix-android) into this
# flake: androidConfigurations beside darwin/nixos, plus the pinned CLI and
# wireless adb helper. Phone ABI lives in hosts/android/oneplus6t.
{ inputs, lib, ... }:
let
deviceModule = ../hosts/android/oneplus6t;
lockFile = ../hosts/android/oneplus6t/apps.lock.json;
# nix-android ships controller packages for these systems only (LIMITS.md).
controllerSystems = [
"aarch64-darwin"
"x86_64-linux"
];
in
{
flake.androidConfigurations = {
# Same phone declaration + lock; pick the output matching the machine
# that runs adb.
oneplus6t-darwin = inputs.nix-android.lib.mkDevice {
system = "aarch64-darwin";
modules = [ deviceModule ];
inherit lockFile;
};
oneplus6t-linux = inputs.nix-android.lib.mkDevice {
system = "x86_64-linux";
modules = [ deviceModule ];
inherit lockFile;
};
};
perSystem =
{
system,
pkgs,
...
}:
let
onController = lib.elem system controllerSystems;
adbWireless = pkgs.writeShellApplication {
name = "adb-wireless";
runtimeInputs = [ pkgs.android-tools ];
text = ''
exec bash ${../scripts/adb-wireless.sh} "$@"
'';
};
in
{
packages = {
adb-wireless = adbWireless;
}
// lib.optionalAttrs onController {
android-rebuild = inputs.nix-android.packages.${system}.android-rebuild;
};
apps = {
adb-wireless = {
type = "app";
program = "${adbWireless}/bin/adb-wireless";
};
}
// lib.optionalAttrs onController {
android-rebuild = {
type = "app";
program = "${inputs.nix-android.packages.${system}.android-rebuild}/bin/android-rebuild";
};
};
};
}