refactor(hardware): major refactor of hardware modules

This commit is contained in:
ooks-io 2024-04-08 17:30:42 +12:00
parent 8f229750b0
commit 4a177d2122
18 changed files with 95 additions and 191 deletions

View file

@ -4,7 +4,6 @@
imports = [
./hardware
./bootloader
./laptop
./nix
./programs
./user

View file

@ -1,16 +0,0 @@
{ lib, config, ... }:
let
cfg = config.systemModules.hardware.backlight;
inherit (lib) mkIf mkEnableOption;
in
{
options.systemModules.hardware.backlight = {
enable = mkEnableOption "Enable backlight module";
};
config = mkIf cfg.enable {
hardware.brillo.enable = true;
};
}

View file

@ -1,29 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.systemModules.hardware.bluetooth;
inherit (lib) mkIf mkEnableOption;
in
{
options.systemModules.hardware.bluetooth = {
enable = mkEnableOption "Enable bluetooth module";
};
config = mkIf cfg.enable {
hardware.bluetooth = {
enable = true;
package = pkgs.bluez5-experimental;
};
environment.systemPackages = with pkgs; [
galaxy-buds-client
live-buds-cli
bluetuith
];
# https://github.com/NixOS/nixpkgs/issues/114222
systemd.user.services.telephony_client.enable = false;
};
}

View file

@ -1,7 +1,8 @@
{
imports = [
./bluetooth
./backlight
./cpu
./gpu
./features
./ssd
];
}

View file

@ -0,0 +1,13 @@
{ lib, config, ... }:
let
features = config.systemModules.hardware.features;
inherit (lib) mkIf;
inherit (builtins) elem;
in
{
config = mkIf (elem "backlight" features) {
hardware.brillo.enable = true;
};
}

View file

@ -2,14 +2,15 @@
{ lib, config, pkgs, ... }:
let
cfg = config.systemModules.laptop.power;
inherit (lib) mkIf mkDefault mkEnableOption mkOption types;
features = config.systemModules.hardware.features;
cfg = config.systemModules.hardware.battery;
inherit (lib) mkIf mkDefault mkOption types;
inherit (builtins) elem;
MHz = x: x * 1000;
in
{
options.systemModules.laptop.power = {
enable = mkEnableOption "Enable laptop power module";
options.systemModules.hardware.battery = {
powersave = {
minFreq = mkOption {
type = types.int;
@ -36,7 +37,7 @@ in
};
};
config = mkIf cfg.enable {
config = mkIf (elem "battery" features) {
boot = {
kernelModules = ["acpi_call"];
extraModulePackages = with config.boot.kernelPackages; [

View file

@ -0,0 +1,24 @@
{ config, lib, pkgs, ... }:
let
features = config.systemModules.hardware.features;
inherit (lib) mkIf;
inherit (builtins) elem;
in
{
config = mkIf (elem "bluetooth" features) {
hardware.bluetooth = {
enable = true;
package = pkgs.bluez5-experimental;
};
environment.systemPackages = with pkgs; [
live-buds-cli
bluetuith
];
# https://github.com/NixOS/nixpkgs/issues/114222
systemd.user.services.telephony_client.enable = false;
};
}

View file

@ -0,0 +1,19 @@
{ lib, config, ... }:
let
inherit (lib) types mkOption;
in
{
imports = [
./bluetooth
./backlight
./battery
];
options.systemModules.hardware.features = mkOption {
type = with types; listOf (enum ["bluetooth" "backlight" "battery"]);
default = [];
description = "What extra hardware feature system modules to use";
};
}

View file

@ -18,12 +18,12 @@ in
mesa
];
extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
boot = {
initrd.kernelModules = ["amdgpu"];
kernelModules = ["amdgpu"];
};
environment.systemPackages = [ pkgs.nvtopPackages.amd ];
services.xserver.videoDrivers = mkDefault ["modesetting" "amdgpu"];
};
boot = {
initrd.kernelModules = ["amdgpu"];
kernelModules = ["amdgpu"];
};
environment.systemPackages = [ pkgs.nvtopPackages.amd ];
services.xserver.videoDrivers = mkDefault ["modesetting" "amdgpu"];
};
}

View file

@ -5,7 +5,7 @@ let
inherit (lib) mkIf;
inherit (builtins) elem;
vaapiIntel = pkgs.vaapiIntel.override {enableHypbridCodec = true;};
# vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;};
in
{

View file

@ -19,7 +19,7 @@ in
nvidiaSettings = false;
nvidiaPersistenced = true;
modesetting.enable = true;
powermanagement = {
powerManagement = {
enable = mkDefault true;
finegrained = mkDefault false;
};

View file

@ -1,6 +0,0 @@
{
imports = [
./power
# ./touchpad
];
}