From 5722d3388750e37723761916a6b92e9dc9d83240 Mon Sep 17 00:00:00 2001 From: Christian Harke Date: Tue, 5 Dec 2023 22:25:43 +0100 Subject: [PATCH] Add Android development tooling --- hosts/nixos-vm/default.nix | 1 + nixos/programs/adb/default.nix | 28 ++++++++++++++++++++++++++++ nixos/roles/android/default.nix | 21 +++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 nixos/programs/adb/default.nix create mode 100644 nixos/roles/android/default.nix diff --git a/hosts/nixos-vm/default.nix b/hosts/nixos-vm/default.nix index 18e82e3c..c8feda46 100644 --- a/hosts/nixos-vm/default.nix +++ b/hosts/nixos-vm/default.nix @@ -6,6 +6,7 @@ custom = { base.users = [ "demo" "christian" ]; roles = { + android.enable = true; desktop.enable = true; gaming.enable = true; printing.enable = true; diff --git a/nixos/programs/adb/default.nix b/nixos/programs/adb/default.nix new file mode 100644 index 00000000..904ae4f5 --- /dev/null +++ b/nixos/programs/adb/default.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.custom.programs.adb; + baseCfg = config.custom.base; + +in + +{ + options = { + custom.programs.adb = { + enable = mkEnableOption "Android Debug Bridge"; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + signify + ]; + + programs.adb.enable = true; + + users.users = genAttrs baseCfg.users (u: { extraGroups = [ "adbusers" ]; }); + }; +} diff --git a/nixos/roles/android/default.nix b/nixos/roles/android/default.nix new file mode 100644 index 00000000..8cb64975 --- /dev/null +++ b/nixos/roles/android/default.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.custom.roles.android; + +in + +{ + options = { + custom.roles.android = { + enable = mkEnableOption "Android tooling"; + }; + }; + + config = mkIf cfg.enable { + custom.programs.adb.enable = true; + }; +}