refactor(hardware): major refactor of hardware modules
This commit is contained in:
parent
8f229750b0
commit
4a177d2122
18 changed files with 95 additions and 191 deletions
|
|
@ -7,14 +7,18 @@
|
||||||
../../profiles
|
../../profiles
|
||||||
];
|
];
|
||||||
|
|
||||||
activeProfiles = ["base" "laptop"];
|
activeProfiles = ["base"];
|
||||||
|
|
||||||
systemModules.user = {
|
systemModules = {
|
||||||
|
user = {
|
||||||
ooks.enable = true;
|
ooks.enable = true;
|
||||||
shell.fish.enable = true;
|
shell.fish.enable = true;
|
||||||
};
|
};
|
||||||
|
hardware = {
|
||||||
systemModules.laptop.power = {
|
cpu.type = "intel";
|
||||||
|
gpu.type = "intel";
|
||||||
|
features = [ "bluetooth" "backlight" "battery" ];
|
||||||
|
battery = {
|
||||||
powersave = {
|
powersave = {
|
||||||
minFreq = 800;
|
minFreq = 800;
|
||||||
maxFreq = 1800;
|
maxFreq = 1800;
|
||||||
|
|
@ -24,6 +28,8 @@
|
||||||
maxFreq = 3600;
|
maxFreq = 3600;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "ookst480s";
|
hostName = "ookst480s";
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
imports = [
|
imports = [
|
||||||
./hardware
|
./hardware
|
||||||
./bootloader
|
./bootloader
|
||||||
./laptop
|
|
||||||
./nix
|
./nix
|
||||||
./programs
|
./programs
|
||||||
./user
|
./user
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./bluetooth
|
./cpu
|
||||||
./backlight
|
./gpu
|
||||||
|
./features
|
||||||
./ssd
|
./ssd
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
system/modules/hardware/features/backlight/default.nix
Normal file
13
system/modules/hardware/features/backlight/default.nix
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -2,14 +2,15 @@
|
||||||
{ lib, config, pkgs, ... }:
|
{ lib, config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systemModules.laptop.power;
|
features = config.systemModules.hardware.features;
|
||||||
inherit (lib) mkIf mkDefault mkEnableOption mkOption types;
|
cfg = config.systemModules.hardware.battery;
|
||||||
|
inherit (lib) mkIf mkDefault mkOption types;
|
||||||
|
inherit (builtins) elem;
|
||||||
MHz = x: x * 1000;
|
MHz = x: x * 1000;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options.systemModules.laptop.power = {
|
options.systemModules.hardware.battery = {
|
||||||
enable = mkEnableOption "Enable laptop power module";
|
|
||||||
powersave = {
|
powersave = {
|
||||||
minFreq = mkOption {
|
minFreq = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
|
|
@ -36,7 +37,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf (elem "battery" features) {
|
||||||
boot = {
|
boot = {
|
||||||
kernelModules = ["acpi_call"];
|
kernelModules = ["acpi_call"];
|
||||||
extraModulePackages = with config.boot.kernelPackages; [
|
extraModulePackages = with config.boot.kernelPackages; [
|
||||||
24
system/modules/hardware/features/bluetooth/default.nix
Normal file
24
system/modules/hardware/features/bluetooth/default.nix
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
||||||
19
system/modules/hardware/features/default.nix
Normal file
19
system/modules/hardware/features/default.nix
Normal 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";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,7 @@ in
|
||||||
mesa
|
mesa
|
||||||
];
|
];
|
||||||
extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
|
extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
|
||||||
|
};
|
||||||
boot = {
|
boot = {
|
||||||
initrd.kernelModules = ["amdgpu"];
|
initrd.kernelModules = ["amdgpu"];
|
||||||
kernelModules = ["amdgpu"];
|
kernelModules = ["amdgpu"];
|
||||||
|
|
@ -25,5 +26,4 @@ in
|
||||||
environment.systemPackages = [ pkgs.nvtopPackages.amd ];
|
environment.systemPackages = [ pkgs.nvtopPackages.amd ];
|
||||||
services.xserver.videoDrivers = mkDefault ["modesetting" "amdgpu"];
|
services.xserver.videoDrivers = mkDefault ["modesetting" "amdgpu"];
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ let
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkIf;
|
||||||
inherit (builtins) elem;
|
inherit (builtins) elem;
|
||||||
|
|
||||||
vaapiIntel = pkgs.vaapiIntel.override {enableHypbridCodec = true;};
|
# vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;};
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ in
|
||||||
nvidiaSettings = false;
|
nvidiaSettings = false;
|
||||||
nvidiaPersistenced = true;
|
nvidiaPersistenced = true;
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
powermanagement = {
|
powerManagement = {
|
||||||
enable = mkDefault true;
|
enable = mkDefault true;
|
||||||
finegrained = mkDefault false;
|
finegrained = mkDefault false;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./power
|
|
||||||
# ./touchpad
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
{ lib, config, pkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.systemProfile.amd;
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
|
|
||||||
hardware.opengl = {
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
vulkan-tools
|
|
||||||
vulkan-loader
|
|
||||||
vulkan-extension-layer
|
|
||||||
vulkan-validation-layer
|
|
||||||
amdvlk
|
|
||||||
mesa
|
|
||||||
];
|
|
||||||
extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
|
|
||||||
};
|
|
||||||
|
|
||||||
boot = {
|
|
||||||
initrd.kernelModules = ["amdgpu"];
|
|
||||||
kernelModules = ["amdgpu"];
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.nvtopPackages.amd ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{ inputs, outputs, lib, config, pkgs, ... }:
|
{ inputs, outputs, lib, config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
isx86Linux = pkgs: with pkgs.stdenv; hostPlatform.isLinux && hostPlatform.isx86;
|
||||||
cfg = config.systemProfile.base;
|
cfg = config.systemProfile.base;
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
@ -51,17 +52,8 @@ in
|
||||||
enableAllFirmware = true;
|
enableAllFirmware = true;
|
||||||
opengl = {
|
opengl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraPackages = with pkgs; [
|
driSupport = true;
|
||||||
intel-media-driver
|
driSupport32Bit = isx86Linux pkgs;
|
||||||
vaapiIntel
|
|
||||||
vaapiVdpau
|
|
||||||
libvdpau-va-gl
|
|
||||||
libva-utils
|
|
||||||
];
|
|
||||||
extraPackages32 = with pkgs.pkgsi686Linux; [
|
|
||||||
vaapiVdpau
|
|
||||||
libvdpau-va-gl
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
system.stateVersion = lib.mkDefault "23.11";
|
system.stateVersion = lib.mkDefault "23.11";
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,8 @@ in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./base
|
./base
|
||||||
./nvidia
|
|
||||||
./gaming
|
./gaming
|
||||||
./laptop
|
|
||||||
./mediaServer
|
./mediaServer
|
||||||
./amd
|
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
@ -29,15 +26,6 @@ in
|
||||||
gaming = {
|
gaming = {
|
||||||
enable = lib.mkEnableOption "Enable the gaming profile";
|
enable = lib.mkEnableOption "Enable the gaming profile";
|
||||||
};
|
};
|
||||||
laptop = {
|
|
||||||
enable = lib.mkEnableOption "Enable the laptop profile";
|
|
||||||
};
|
|
||||||
nvidia = {
|
|
||||||
enable = lib.mkEnableOption "Enable the nvidia profile";
|
|
||||||
};
|
|
||||||
amd = {
|
|
||||||
enable = lib.mkEnableOption "Enable the amd profile";
|
|
||||||
};
|
|
||||||
mediaServer = {
|
mediaServer = {
|
||||||
enable = lib.mkEnableOption "Enable the mediaServer profile";
|
enable = lib.mkEnableOption "Enable the mediaServer profile";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.systemProfile.laptop;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
../../modules
|
|
||||||
];
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
systemModules = {
|
|
||||||
hardware = {
|
|
||||||
bluetooth.enable = true;
|
|
||||||
backlight.enable = true;
|
|
||||||
};
|
|
||||||
laptop.power.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
{ lib, config, pkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.systemProfile.nvidia;
|
|
||||||
production = config.boot.kernelPackages.nvidiaPackages.production;
|
|
||||||
beta = config.boot.kernelPackages.nvidiaPackages.beta;
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
hardware.nvidia = {
|
|
||||||
open = true;
|
|
||||||
package = production;
|
|
||||||
modesetting.enable = true;
|
|
||||||
nvidiaSettings = true;
|
|
||||||
powerManagement.enable = true;
|
|
||||||
};
|
|
||||||
hardware.opengl.extraPackages = with pkgs; [ nvidia-vaapi-driver ];
|
|
||||||
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ nvidia-vaapi-driver ];
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
environment.sessionVariables = {
|
|
||||||
LIBVA_DRIVER_NAME = "nvidia";
|
|
||||||
NVD_BACKEND = "direct";
|
|
||||||
};
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
nvtopPackages.nvidia
|
|
||||||
mesa
|
|
||||||
|
|
||||||
libva
|
|
||||||
libva-utils
|
|
||||||
|
|
||||||
vulkan-loader
|
|
||||||
vulkan-validation-layers
|
|
||||||
vulkan-tools
|
|
||||||
vulkan-extension-layer
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue