feat(modules): hardware modules — intel/amd/nvidia/audio/bluetooth/touchpad
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0ca8dd3929
commit
620af4f502
8 changed files with 831 additions and 0 deletions
348
modules/hardware/README.md
Normal file
348
modules/hardware/README.md
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
# Hardware Directory - Hardware Support Modules
|
||||
|
||||
The `modules/hardware/` directory contains specialized modules for hardware detection, configuration, and optimization. These modules automatically detect available hardware and configure appropriate drivers, settings, and optimizations.
|
||||
|
||||
## Hardware Architecture
|
||||
|
||||
The hardware system uses conditional configuration based on detected hardware:
|
||||
```nix
|
||||
config = lib.mkIf cfg.hardware.nvidia.enable {
|
||||
# NVIDIA-specific configuration only when NVIDIA hardware is present
|
||||
};
|
||||
```
|
||||
|
||||
## Core Hardware Module
|
||||
|
||||
### `default.nix`
|
||||
**Purpose**: Main hardware detection and coordination module
|
||||
**What it does**:
|
||||
- Detects available hardware components
|
||||
- Enables appropriate hardware-specific modules
|
||||
- Coordinates between different hardware configurations
|
||||
- Provides common hardware configuration options
|
||||
|
||||
**Detection Logic**:
|
||||
- GPU detection (Intel, AMD, NVIDIA)
|
||||
- Audio hardware identification
|
||||
- Input device configuration
|
||||
- Network hardware setup
|
||||
|
||||
**Module Coordination**:
|
||||
```nix
|
||||
imports = [
|
||||
./audio.nix
|
||||
./bluetooth.nix
|
||||
./intel.nix
|
||||
./amd.nix
|
||||
./nvidia.nix
|
||||
./touchpad.nix
|
||||
];
|
||||
```
|
||||
|
||||
## Graphics Hardware
|
||||
|
||||
### `intel.nix`
|
||||
**Purpose**: Intel integrated graphics configuration
|
||||
**Hardware Support**:
|
||||
- Intel HD Graphics (all generations)
|
||||
- Intel Iris Graphics
|
||||
- Intel Arc discrete graphics
|
||||
|
||||
**What it configures**:
|
||||
- Intel graphics drivers (i915)
|
||||
- Hardware acceleration (VA-API)
|
||||
- Power management optimizations
|
||||
- Display output configuration
|
||||
|
||||
**Features**:
|
||||
- Vulkan support for gaming
|
||||
- Hardware video decoding
|
||||
- Power-efficient graphics scaling
|
||||
- Multi-monitor support
|
||||
|
||||
**Configuration Options**:
|
||||
```nix
|
||||
omni.hardware.intel = {
|
||||
enable = true;
|
||||
powerSaving = true; # Enable power optimizations
|
||||
vulkan = true; # Enable Vulkan API support
|
||||
};
|
||||
```
|
||||
|
||||
### `amd.nix`
|
||||
**Purpose**: AMD graphics card configuration
|
||||
**Hardware Support**:
|
||||
- AMD Radeon RX series
|
||||
- AMD Radeon Pro series
|
||||
- AMD APU integrated graphics
|
||||
|
||||
**What it configures**:
|
||||
- AMDGPU drivers (open-source)
|
||||
- RADV Vulkan drivers
|
||||
- Hardware acceleration (VA-API/VDPAU)
|
||||
- OpenCL compute support
|
||||
|
||||
**Features**:
|
||||
- Gaming optimizations
|
||||
- Content creation acceleration
|
||||
- Multi-GPU configurations
|
||||
- FreeSync support
|
||||
|
||||
**Performance Tuning**:
|
||||
- Dynamic frequency scaling
|
||||
- Power management profiles
|
||||
- Thermal management
|
||||
- Memory clock optimization
|
||||
|
||||
### `nvidia.nix`
|
||||
**Purpose**: NVIDIA graphics card configuration
|
||||
**Hardware Support**:
|
||||
- NVIDIA GeForce RTX/GTX series
|
||||
- NVIDIA Quadro professional cards
|
||||
- NVIDIA Tesla compute cards
|
||||
|
||||
**What it configures**:
|
||||
- Proprietary NVIDIA drivers
|
||||
- CUDA toolkit integration
|
||||
- Hardware acceleration
|
||||
- Power management
|
||||
|
||||
**Features**:
|
||||
- Game-ready drivers
|
||||
- NVENC/NVDEC hardware encoding
|
||||
- CUDA development support
|
||||
- G-Sync compatibility
|
||||
- Optimus laptop support
|
||||
|
||||
**Special Considerations**:
|
||||
- Wayland compatibility configuration
|
||||
- Hybrid graphics laptop support
|
||||
- Multiple monitor setup
|
||||
- Custom kernel parameters
|
||||
|
||||
## Audio Hardware
|
||||
|
||||
### `audio.nix`
|
||||
**Purpose**: Audio system configuration and optimization
|
||||
**Audio Stack**: PipeWire with ALSA/PulseAudio compatibility
|
||||
|
||||
**What it configures**:
|
||||
- PipeWire audio server
|
||||
- Low-latency audio for content creation
|
||||
- Multiple audio device management
|
||||
- Bluetooth audio support
|
||||
|
||||
**Supported Hardware**:
|
||||
- Built-in laptop audio
|
||||
- USB audio interfaces
|
||||
- Professional audio equipment
|
||||
- Bluetooth headphones and speakers
|
||||
|
||||
**Features**:
|
||||
- Real-time audio processing
|
||||
- Multi-channel audio support
|
||||
- Audio routing and mixing
|
||||
- Professional audio plugin support
|
||||
|
||||
**Optimizations**:
|
||||
- Low-latency configuration
|
||||
- Buffer size optimization
|
||||
- Audio priority scheduling
|
||||
- Hardware-specific tweaks
|
||||
|
||||
## Input Devices
|
||||
|
||||
### `touchpad.nix`
|
||||
**Purpose**: Laptop touchpad configuration and gestures
|
||||
**What it configures**:
|
||||
- Touchpad sensitivity and acceleration
|
||||
- Multi-touch gesture support
|
||||
- Palm rejection
|
||||
- Scrolling behavior
|
||||
|
||||
**Gesture Support**:
|
||||
- Two-finger scrolling
|
||||
- Pinch-to-zoom
|
||||
- Three-finger swipe navigation
|
||||
- Four-finger workspace switching
|
||||
|
||||
**Customization Options**:
|
||||
- Sensitivity adjustment
|
||||
- Acceleration curves
|
||||
- Gesture threshold tuning
|
||||
- Disable-while-typing settings
|
||||
|
||||
## Connectivity
|
||||
|
||||
### `bluetooth.nix`
|
||||
**Purpose**: Bluetooth hardware and device management
|
||||
**What it configures**:
|
||||
- BlueZ Bluetooth stack
|
||||
- Device pairing and authentication
|
||||
- Audio codec support (A2DP, aptX)
|
||||
- Power management
|
||||
|
||||
**Supported Devices**:
|
||||
- Bluetooth headphones/speakers
|
||||
- Keyboards and mice
|
||||
- Game controllers
|
||||
- File transfer devices
|
||||
|
||||
**Features**:
|
||||
- Automatic device reconnection
|
||||
- Multiple device management
|
||||
- Profile switching
|
||||
- Battery level monitoring
|
||||
|
||||
## Hardware Detection Logic
|
||||
|
||||
### Automatic Detection
|
||||
The hardware system automatically detects:
|
||||
|
||||
```nix
|
||||
# GPU Detection
|
||||
gpu = if builtins.pathExists "/sys/class/drm/card0" then
|
||||
# Detect GPU vendor from driver information
|
||||
# Enable appropriate GPU module
|
||||
else null;
|
||||
|
||||
# Audio Detection
|
||||
audio = if config.sound.enable then
|
||||
# Configure audio hardware
|
||||
else null;
|
||||
```
|
||||
|
||||
### Manual Override
|
||||
Users can override automatic detection:
|
||||
|
||||
```nix
|
||||
# Force NVIDIA configuration even if not detected
|
||||
omni.hardware.nvidia.enable = true;
|
||||
omni.hardware.nvidia.prime = {
|
||||
enable = true;
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
```
|
||||
|
||||
## Power Management
|
||||
|
||||
### Laptop Optimization
|
||||
- Battery life optimization
|
||||
- CPU frequency scaling
|
||||
- GPU power states
|
||||
- Display brightness control
|
||||
|
||||
### Desktop Performance
|
||||
- Maximum performance profiles
|
||||
- Gaming optimizations
|
||||
- Content creation acceleration
|
||||
- Thermal management
|
||||
|
||||
## Multi-GPU Systems
|
||||
|
||||
### Hybrid Graphics (Optimus/Prime)
|
||||
- Automatic GPU switching
|
||||
- Application-specific GPU assignment
|
||||
- Power saving when not gaming
|
||||
- External display routing
|
||||
|
||||
### Multi-GPU Rendering
|
||||
- SLI/CrossFire support where applicable
|
||||
- Compute workload distribution
|
||||
- Mining/AI acceleration setup
|
||||
|
||||
## Hardware-Specific Optimizations
|
||||
|
||||
### Gaming Configuration
|
||||
```nix
|
||||
omni.hardware.gaming = {
|
||||
enable = true;
|
||||
performance = "high";
|
||||
gpu = "nvidia"; # or "amd" or "intel"
|
||||
};
|
||||
```
|
||||
|
||||
### Content Creation
|
||||
```nix
|
||||
omni.hardware.creation = {
|
||||
enable = true;
|
||||
audio.lowLatency = true;
|
||||
gpu.acceleration = true;
|
||||
};
|
||||
```
|
||||
|
||||
### Development Workstation
|
||||
```nix
|
||||
omni.hardware.development = {
|
||||
enable = true;
|
||||
containers = true;
|
||||
virtualization = true;
|
||||
};
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Hardware Detection Issues
|
||||
- Check `lspci` output for hardware presence
|
||||
- Verify kernel module loading
|
||||
- Check hardware compatibility lists
|
||||
|
||||
### Driver Problems
|
||||
- Use hardware-specific logs
|
||||
- Check driver version compatibility
|
||||
- Verify configuration syntax
|
||||
|
||||
### Performance Issues
|
||||
- Monitor hardware utilization
|
||||
- Check thermal throttling
|
||||
- Verify power management settings
|
||||
|
||||
## Adding New Hardware Support
|
||||
|
||||
### Creating Hardware Modules
|
||||
|
||||
1. **Create Module File**:
|
||||
```nix
|
||||
# modules/hardware/my-hardware.nix
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.omni.hardware.myHardware;
|
||||
in {
|
||||
options.omni.hardware.myHardware = {
|
||||
enable = mkEnableOption "My Hardware support";
|
||||
# Additional options...
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Hardware configuration
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
2. **Add to Hardware Module**:
|
||||
```nix
|
||||
# In modules/hardware/default.nix
|
||||
imports = [
|
||||
# ... existing imports
|
||||
./my-hardware.nix
|
||||
];
|
||||
```
|
||||
|
||||
3. **Implement Detection**:
|
||||
```nix
|
||||
# Add automatic detection logic
|
||||
config.omni.hardware.myHardware.enable = mkDefault (
|
||||
# Detection logic here
|
||||
);
|
||||
```
|
||||
|
||||
### Hardware Module Guidelines
|
||||
- Use conditional configuration (`mkIf`)
|
||||
- Provide sensible defaults
|
||||
- Include performance optimizations
|
||||
- Document hardware requirements
|
||||
- Test on multiple hardware configurations
|
||||
|
||||
This comprehensive hardware support system ensures Omnixient works optimally across a wide variety of hardware configurations while providing easy customization for specific needs.
|
||||
41
modules/hardware/amd.nix
Normal file
41
modules/hardware/amd.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hardware.amd.enable = mkEnableOption "AMD graphics support";
|
||||
|
||||
config = mkIf config.hardware.amd.enable {
|
||||
# AMD driver configuration
|
||||
services.xserver.videoDrivers = [ "amdgpu" ];
|
||||
|
||||
# Enable AMD GPU support
|
||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||
|
||||
# AMD specific packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
radeontop
|
||||
nvtopPackages.amd
|
||||
];
|
||||
|
||||
# Graphics packages for AMD
|
||||
hardware.graphics.extraPackages = with pkgs; [
|
||||
amdvlk
|
||||
rocm-opencl-icd
|
||||
rocm-opencl-runtime
|
||||
];
|
||||
|
||||
hardware.graphics.extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||
driversi686Linux.amdvlk
|
||||
];
|
||||
|
||||
# AMD GPU firmware
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
};
|
||||
}
|
||||
48
modules/hardware/audio.nix
Normal file
48
modules/hardware/audio.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hardware.audio.pipewire.enable = mkEnableOption "PipeWire audio system";
|
||||
|
||||
config = mkIf config.hardware.audio.pipewire.enable {
|
||||
# PipeWire configuration
|
||||
security.rtkit.enable = true;
|
||||
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
|
||||
# Audio packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Audio control
|
||||
pavucontrol
|
||||
pulsemixer
|
||||
alsamixer
|
||||
|
||||
# Audio tools
|
||||
audacity
|
||||
pulseaudio
|
||||
|
||||
# Bluetooth audio
|
||||
bluez
|
||||
bluez-tools
|
||||
];
|
||||
|
||||
# Disable PulseAudio (conflicts with PipeWire)
|
||||
services.pulseaudio.enable = false;
|
||||
|
||||
# Audio group for user
|
||||
users.groups.audio = { };
|
||||
};
|
||||
}
|
||||
68
modules/hardware/bluetooth.nix
Normal file
68
modules/hardware/bluetooth.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hardware.bluetooth.enhanced.enable = mkEnableOption "Enhanced Bluetooth support";
|
||||
|
||||
config = mkIf config.hardware.bluetooth.enhanced.enable {
|
||||
# Enable Bluetooth
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
settings = {
|
||||
General = {
|
||||
Experimental = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Bluetooth services
|
||||
services.blueman.enable = true;
|
||||
|
||||
# Bluetooth packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
bluez
|
||||
bluez-tools
|
||||
blueman
|
||||
bluetui
|
||||
];
|
||||
|
||||
# MT7925 bluetooth workaround — the bluetooth USB endpoint on
|
||||
# Strix Halo can be slow to enumerate after warm reboot. Reloading
|
||||
# modules helps. A cold boot (full power off) always works.
|
||||
# See: https://github.com/moolooite/mt7925e-bt-heal
|
||||
systemd.services.mt7925-bt-heal = {
|
||||
description = "Unblock and power on MT7925 bluetooth";
|
||||
after = [ "bluetooth.service" ];
|
||||
wants = [ "bluetooth.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/sleep 5";
|
||||
ExecStart = pkgs.writeShellScript "mt7925-bt-heal" ''
|
||||
# Only unblock if adapter has a valid MAC (firmware loaded)
|
||||
# A warm reboot leaves the adapter with 00:00:00:00:00:00
|
||||
# and rfkill unblock would kill it — skip in that case.
|
||||
MAC=$(${pkgs.bluez}/bin/hciconfig hci0 2>/dev/null | grep "BD Address" | awk '{print $3}')
|
||||
if [ -z "$MAC" ] || [ "$MAC" = "00:00:00:00:00:00" ]; then
|
||||
echo "Bluetooth adapter not ready (MAC: $MAC) — needs cold boot"
|
||||
exit 0
|
||||
fi
|
||||
echo "Bluetooth adapter found: $MAC"
|
||||
${pkgs.util-linux}/bin/rfkill unblock bluetooth
|
||||
sleep 1
|
||||
${pkgs.bluez}/bin/bluetoothctl power on
|
||||
echo "Bluetooth powered on"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
181
modules/hardware/default.nix
Normal file
181
modules/hardware/default.nix
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkDefault;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./nvidia.nix
|
||||
./amd.nix
|
||||
./intel.nix
|
||||
./audio.nix
|
||||
./bluetooth.nix
|
||||
./touchpad.nix
|
||||
];
|
||||
|
||||
# Common hardware support
|
||||
hardware = {
|
||||
# Enable redistributable firmware only
|
||||
enableRedistributableFirmware = true;
|
||||
|
||||
# CPU microcode updates
|
||||
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
# Graphics support
|
||||
graphics = {
|
||||
enable = true;
|
||||
|
||||
# Common graphics packages
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver # Intel VAAPI
|
||||
intel-vaapi-driver
|
||||
libva-vdpau-driver
|
||||
libvdpau-va-gl
|
||||
intel-compute-runtime # Intel OpenCL
|
||||
];
|
||||
|
||||
extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||
intel-vaapi-driver
|
||||
libva-vdpau-driver
|
||||
libvdpau-va-gl
|
||||
];
|
||||
};
|
||||
|
||||
# USB support
|
||||
usb-modeswitch.enable = true;
|
||||
|
||||
# Sensor support (for laptops)
|
||||
sensor.iio.enable = true;
|
||||
|
||||
# Scanner support
|
||||
sane = {
|
||||
enable = true;
|
||||
extraBackends = with pkgs; [
|
||||
sane-airscan
|
||||
# epkowa removed due to iscan build issues
|
||||
# Use epsonscan2 or imagescan for Epson scanner support instead
|
||||
];
|
||||
};
|
||||
|
||||
# Firmware updater (moved to services section)
|
||||
};
|
||||
|
||||
# Kernel modules
|
||||
boot.kernelModules = [
|
||||
# Virtualization
|
||||
"kvm-intel"
|
||||
"kvm-amd"
|
||||
|
||||
# USB
|
||||
"usbhid"
|
||||
|
||||
# Bluetooth
|
||||
"btusb"
|
||||
"btmtk"
|
||||
|
||||
# Network
|
||||
"iwlwifi"
|
||||
];
|
||||
|
||||
# Power management
|
||||
powerManagement = {
|
||||
enable = true;
|
||||
cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
};
|
||||
|
||||
services = {
|
||||
# Thermal management
|
||||
thermald.enable = mkDefault true;
|
||||
|
||||
# Power profiles daemon (modern power management)
|
||||
power-profiles-daemon.enable = true;
|
||||
|
||||
# Hardware monitoring
|
||||
smartd = {
|
||||
enable = true;
|
||||
autodetect = true;
|
||||
};
|
||||
|
||||
# Automatic CPU frequency scaling
|
||||
auto-cpufreq = {
|
||||
enable = false; # Disabled by default, conflicts with power-profiles-daemon
|
||||
settings = {
|
||||
battery = {
|
||||
governor = "powersave";
|
||||
turbo = "never";
|
||||
};
|
||||
charger = {
|
||||
governor = "performance";
|
||||
turbo = "auto";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Additional hardware-specific packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Hardware info
|
||||
lshw
|
||||
hwinfo
|
||||
inxi
|
||||
dmidecode
|
||||
util-linux # provides lscpu
|
||||
pciutils # provides lspci
|
||||
usbutils # provides lsusb
|
||||
|
||||
# Disk tools
|
||||
smartmontools
|
||||
hdparm
|
||||
nvme-cli
|
||||
|
||||
# CPU tools
|
||||
cpufrequtils
|
||||
cpupower-gui
|
||||
|
||||
# GPU tools
|
||||
mesa-demos
|
||||
vulkan-tools
|
||||
|
||||
# Sensors
|
||||
lm_sensors
|
||||
|
||||
# Power management
|
||||
powertop
|
||||
acpi
|
||||
|
||||
# Benchmarking
|
||||
stress
|
||||
stress-ng
|
||||
s-tui
|
||||
];
|
||||
|
||||
# Udev rules for hardware
|
||||
services.udev = {
|
||||
enable = true;
|
||||
|
||||
extraRules = ''
|
||||
# Allow users in wheel group to control backlight
|
||||
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="*", GROUP="wheel", MODE="0664"
|
||||
|
||||
# Allow users in wheel group to control LEDs
|
||||
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="*", GROUP="wheel", MODE="0664"
|
||||
|
||||
# Gaming controllers
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="028e", GROUP="wheel", MODE="0664"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="028f", GROUP="wheel", MODE="0664"
|
||||
'';
|
||||
};
|
||||
|
||||
# Virtual console configuration
|
||||
console = {
|
||||
earlySetup = lib.mkForce false;
|
||||
font = lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz";
|
||||
packages = [ pkgs.terminus_font ];
|
||||
};
|
||||
}
|
||||
45
modules/hardware/intel.nix
Normal file
45
modules/hardware/intel.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hardware.intel.enable = mkEnableOption "Intel graphics support";
|
||||
|
||||
config = mkIf config.hardware.intel.enable {
|
||||
# Intel driver configuration
|
||||
services.xserver.videoDrivers = [ "modesetting" ];
|
||||
|
||||
# Enable Intel GPU support
|
||||
boot.initrd.kernelModules = [ "i915" ];
|
||||
|
||||
# Intel GPU early loading
|
||||
boot.kernelParams = [ "i915.enable_guc=2" ];
|
||||
|
||||
# Intel specific packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
intel-gpu-tools
|
||||
nvtopPackages.intel
|
||||
];
|
||||
|
||||
# Graphics packages for Intel (already configured in default.nix)
|
||||
hardware.graphics.extraPackages = with pkgs; [
|
||||
intel-media-driver
|
||||
intel-vaapi-driver
|
||||
intel-compute-runtime
|
||||
intel-ocl
|
||||
];
|
||||
|
||||
hardware.graphics.extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||
intel-vaapi-driver
|
||||
];
|
||||
|
||||
# Intel GPU power management
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
};
|
||||
}
|
||||
41
modules/hardware/nvidia.nix
Normal file
41
modules/hardware/nvidia.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hardware.nvidia.enable = mkEnableOption "NVIDIA graphics support";
|
||||
|
||||
config = mkIf config.hardware.nvidia.enable {
|
||||
# NVIDIA driver configuration
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = false;
|
||||
powerManagement.finegrained = false;
|
||||
open = false;
|
||||
nvidiaSettings = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
};
|
||||
|
||||
# NVIDIA specific packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
nvidia-vaapi-driver
|
||||
libva-utils
|
||||
nvtopPackages.nvidia
|
||||
];
|
||||
|
||||
# Graphics packages for NVIDIA
|
||||
hardware.graphics.extraPackages = with pkgs; [
|
||||
nvidia-vaapi-driver
|
||||
libva-vdpau-driver
|
||||
libvdpau-va-gl
|
||||
];
|
||||
};
|
||||
}
|
||||
59
modules/hardware/touchpad.nix
Normal file
59
modules/hardware/touchpad.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hardware.touchpad.enable = mkEnableOption "Enhanced touchpad support";
|
||||
|
||||
config = mkIf config.hardware.touchpad.enable {
|
||||
# Touchpad support via libinput
|
||||
services.libinput = {
|
||||
enable = true;
|
||||
touchpad = {
|
||||
tapping = true;
|
||||
tappingDragLock = true;
|
||||
naturalScrolling = true;
|
||||
scrollMethod = "twofinger";
|
||||
disableWhileTyping = true;
|
||||
middleEmulation = true;
|
||||
accelProfile = "adaptive";
|
||||
};
|
||||
};
|
||||
|
||||
# Synaptics touchpad (alternative, disabled by default)
|
||||
services.xserver.synaptics = {
|
||||
enable = false;
|
||||
twoFingerScroll = true;
|
||||
palmDetect = true;
|
||||
tapButtons = true;
|
||||
buttonsMap = [
|
||||
1
|
||||
3
|
||||
2
|
||||
];
|
||||
fingersMap = [
|
||||
0
|
||||
0
|
||||
0
|
||||
];
|
||||
};
|
||||
|
||||
# Touchpad packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
libinput
|
||||
xinput
|
||||
xorg.xf86inputlibinput
|
||||
];
|
||||
|
||||
# Touchpad gesture support
|
||||
services.touchegg = {
|
||||
enable = false; # Disabled by default, enable if needed
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue