host/home: add android sdk
This commit is contained in:
parent
c526473f4f
commit
19dbd21f4b
4 changed files with 61 additions and 6 deletions
8
Makefile
8
Makefile
|
@ -1,4 +1,4 @@
|
|||
NIX_RUN := sudo nix run .\#
|
||||
NIX_RUN := nix run .\#
|
||||
NIX_LOCK := nix flake lock
|
||||
|
||||
DEPS_MY := \
|
||||
|
@ -34,14 +34,14 @@ define machine_rule
|
|||
.PHONY: $(1)
|
||||
$(1): ;
|
||||
systemctl --user reset-failed
|
||||
$$(NIX_RUN)switch/$(1)
|
||||
sudo $$(NIX_RUN)switch/$(1)
|
||||
|
||||
.PHONY: rollback-$(1)
|
||||
rollback-$(1):
|
||||
$$(NIX_RUN)rollback/$(1)
|
||||
sudo $$(NIX_RUN)rollback/$(1)
|
||||
|
||||
.PHONY: test-$(1)
|
||||
test-$(1): ; $$(NIX_RUN)test/$(1)
|
||||
test-$(1): ; sudo $$(NIX_RUN)test/$(1)
|
||||
endef
|
||||
|
||||
define vps_rule
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
(hostname: machine: pkgs.writeShellScript "deploy-${hostname}" ''
|
||||
${nixos-rebuild}/bin/nixos-rebuild switch \
|
||||
--flake .#${hostname} \
|
||||
--target-host ${machine.config.deployment.targetHost} \
|
||||
--target-host root@${machine.config.deployment.targetHost} \
|
||||
$@
|
||||
'')
|
||||
vpsMachines);
|
||||
|
|
|
@ -29,6 +29,8 @@ in
|
|||
(lib.mkIf config.virtualisation.docker.enable "docker")
|
||||
(lib.mkIf config.services.transmission.enable "transmission")
|
||||
(lib.mkIf config.services.kubo.enable "ipfs")
|
||||
(lib.mkIf config.programs.adb.enable "adbusers")
|
||||
(lib.mkIf config.programs.adb.enable "plugdev")
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
hashedPasswordFile = config.age.secrets.users-jan-passfile.path;
|
||||
|
@ -36,6 +38,8 @@ in
|
|||
openssh.authorizedKeys.keys = data.publicKeys.users.jan;
|
||||
};
|
||||
|
||||
users.groups.plugdev = lib.mkIf config.programs.adb.enable { };
|
||||
|
||||
home-manager.users.jan = { lib, ... }: {
|
||||
imports = [
|
||||
inputs.wired.homeManagerModules.default
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
|
@ -48,7 +49,12 @@
|
|||
# enable bluetooth
|
||||
hardware.bluetooth.enable = true;
|
||||
|
||||
local.nix.allowUnfreePackages = [ "cnijfilter2" "memtest86" ];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
local.nix.allowUnfreePackages = [
|
||||
"cnijfilter2"
|
||||
"memtest86"
|
||||
"android-sdk-cmdline-tools"
|
||||
];
|
||||
|
||||
services.openssh.enable = true;
|
||||
|
||||
|
@ -118,4 +124,49 @@
|
|||
|
||||
# 3D printing
|
||||
local.octoprint.enable = true;
|
||||
|
||||
# Android
|
||||
programs.adb.enable = true;
|
||||
programs.java = {
|
||||
enable = true;
|
||||
package = pkgs.jdk17;
|
||||
};
|
||||
|
||||
nixpkgs.config.android_sdk.accept_license = true;
|
||||
|
||||
environment.variables =
|
||||
let
|
||||
buildToolsVersion = "33.0.2";
|
||||
androidComposition = pkgs.unstable.androidenv.composeAndroidPackages {
|
||||
platformToolsVersion = "34.0.5";
|
||||
buildToolsVersions = [ buildToolsVersion ];
|
||||
includeEmulator = false;
|
||||
emulatorVersion = "34.1.9";
|
||||
platformVersions = [ "29" "30" "33" ];
|
||||
includeSources = false;
|
||||
includeSystemImages = false;
|
||||
systemImageTypes = [ "google_apis_playstore" ];
|
||||
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
|
||||
cmakeVersions = [ "3.10.2" ];
|
||||
includeNDK = true;
|
||||
ndkVersions = [ "23.2.8568313" ];
|
||||
useGoogleAPIs = false;
|
||||
useGoogleTVAddOns = false;
|
||||
includeExtras = [
|
||||
"extras;google;gcm"
|
||||
];
|
||||
};
|
||||
in
|
||||
rec {
|
||||
ANDROID_SDK_ROOT = "${androidComposition.androidsdk}/libexec/android-sdk";
|
||||
ANDROID_NDK_ROOT = "${ANDROID_SDK_ROOT}/ndk-bundle";
|
||||
|
||||
# Use the same buildToolsVersion here
|
||||
# GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${buildToolsVersion}/aapt2";
|
||||
# JAVA_HOME = pkgs.jdk17.home;
|
||||
};
|
||||
|
||||
services.udev.extraRules = ''
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev"
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue