From 89ebaa520fd09294c5619d1d19aba5e14a1b0dff Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 14 Jul 2024 19:30:28 -0400 Subject: [PATCH] refactor: move adb to flake module --- devices/binto/default.nix | 7 ++++++- devices/wim/default.nix | 7 ++++++- flake.in.nix | 1 + modules/adb.nix | 24 ++++++++++++++++++++++++ modules/android.nix | 6 ------ 5 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 modules/adb.nix delete mode 100644 modules/android.nix diff --git a/devices/binto/default.nix b/devices/binto/default.nix index b541f6cc..31085b59 100644 --- a/devices/binto/default.nix +++ b/devices/binto/default.nix @@ -8,7 +8,6 @@ in { imports = [ ./hardware-configuration.nix - ../../modules/android.nix ../../modules/ags ../../modules/audio.nix ../../modules/kmscon.nix @@ -20,6 +19,7 @@ in { ./modules/gpu-replay.nix ./modules/nix-gaming.nix + self.nixosModules.adb self.nixosModules.desktop ]; @@ -38,6 +38,11 @@ in { fontSize = 12.5; }; + programs.adb = { + enable = true; + user = mainUser; + }; + users.users.${mainUser} = { isNormalUser = true; extraGroups = [ diff --git a/devices/wim/default.nix b/devices/wim/default.nix index ebff4191..b765d24c 100644 --- a/devices/wim/default.nix +++ b/devices/wim/default.nix @@ -8,7 +8,6 @@ in { imports = [ ./hardware-configuration.nix - ../../modules/android.nix ../../modules/ags ../../modules/audio.nix ../../modules/kmscon.nix @@ -17,6 +16,7 @@ in { ./modules/security.nix + self.nixosModules.adb self.nixosModules.desktop self.nixosModules.plymouth ]; @@ -37,6 +37,11 @@ in { fontSize = 12.5; }; + programs.adb = { + enable = true; + user = mainUser; + }; + boot.plymouth = { enable = true; theme = "dracula"; diff --git a/flake.in.nix b/flake.in.nix index c41e5b9a..1cb2844b 100644 --- a/flake.in.nix +++ b/flake.in.nix @@ -56,6 +56,7 @@ attrs system (mkPkgs system nixpkgs)); in { nixosModules = { + adb = import ./modules/adb.nix; desktop = import ./modules/desktop; nvidia = import ./modules/nvidia.nix; plymouth = import ./modules/plymouth.nix; diff --git a/modules/adb.nix b/modules/adb.nix new file mode 100644 index 00000000..7955bf28 --- /dev/null +++ b/modules/adb.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkIf mkOption types; + + cfg = config.programs.adb; +in { + options.programs.adb = { + user = mkOption { + type = types.str; + default = "root"; + description = '' + The name of the user who is going to interact with + the android devices. + ''; + }; + }; + + config = mkIf cfg.enable { + users.users.${cfg.user}.extraGroups = ["adbusers"]; + }; +} diff --git a/modules/android.nix b/modules/android.nix deleted file mode 100644 index 89e4a54c..00000000 --- a/modules/android.nix +++ /dev/null @@ -1,6 +0,0 @@ -{config, ...}: let - inherit (config.vars) mainUser; -in { - programs.adb.enable = true; - users.users.${mainUser}.extraGroups = ["adbusers"]; -}