Compare commits
3 commits
b7d9ef4800
...
7948dc284b
| Author | SHA1 | Date | |
|---|---|---|---|
| 7948dc284b | |||
| 183f3b48c8 | |||
| f54cee8f70 |
5 changed files with 88 additions and 5 deletions
|
|
@ -26,6 +26,12 @@
|
|||
firmware = {
|
||||
cpuFlavor = "intel";
|
||||
};
|
||||
|
||||
graphics = {
|
||||
enable = true;
|
||||
|
||||
gpuFlavor = "intel";
|
||||
};
|
||||
};
|
||||
|
||||
hardware = {
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
./bluetooth
|
||||
./ergodox
|
||||
./firmware
|
||||
./mx-ergo
|
||||
./graphics
|
||||
./networking
|
||||
./sound
|
||||
./trackball
|
||||
./upower
|
||||
];
|
||||
}
|
||||
|
|
|
|||
75
modules/nixos/hardware/graphics/default.nix
Normal file
75
modules/nixos/hardware/graphics/default.nix
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.hardware.graphics;
|
||||
in
|
||||
{
|
||||
options.my.hardware.graphics = with lib; {
|
||||
enable = mkEnableOption "graphics configuration";
|
||||
|
||||
gpuFlavor = mkOption {
|
||||
type = with types; nullOr (enum [ "amd" "intel" ]);
|
||||
default = null;
|
||||
example = "intel";
|
||||
description = "Which kind of GPU to install driver for";
|
||||
};
|
||||
|
||||
amd = {
|
||||
enableKernelModule = lib.my.mkDisableOption "Kernel driver module";
|
||||
|
||||
amdvlk = lib.mkEnableOption "Use AMDVLK instead of Mesa RADV driver";
|
||||
};
|
||||
|
||||
intel = {
|
||||
enableKernelModule = lib.my.mkDisableOption "Kernel driver module";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
{
|
||||
hardware.opengl = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
|
||||
# AMD GPU
|
||||
(lib.mkIf (cfg.gpuFlavor == "amd") {
|
||||
boot.initrd.kernelModules = lib.mkIf cfg.amd.enableKernelModule [ "amdgpu" ];
|
||||
|
||||
hardware.opengl = {
|
||||
extraPackages = with pkgs; [
|
||||
# OpenCL
|
||||
rocmPackages.clr
|
||||
rocmPackages.clr.icd
|
||||
]
|
||||
++ lib.optional cfg.amd.amdvlk amdvlk
|
||||
;
|
||||
|
||||
extraPackages32 = with pkgs; [
|
||||
]
|
||||
++ lib.optional cfg.amd.amdvlk driversi686Linux.amdvlk
|
||||
;
|
||||
};
|
||||
})
|
||||
|
||||
# Intel GPU
|
||||
(lib.mkIf (cfg.gpuFlavor == "intel") {
|
||||
boot.initrd.kernelModules = lib.mkIf cfg.intel.enableKernelModule [ "i915" ];
|
||||
|
||||
environment.variables = {
|
||||
VDPAU_DRIVER = "va_gl";
|
||||
};
|
||||
|
||||
hardware.opengl = {
|
||||
extraPackages = with pkgs; [
|
||||
# Open CL
|
||||
intel-compute-runtime
|
||||
|
||||
# VA API
|
||||
intel-media-driver
|
||||
intel-vaapi-driver
|
||||
libvdpau-va-gl
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
# Hold down the `next page` button to scroll using the ball
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.hardware.mx-ergo;
|
||||
cfg = config.my.hardware.trackball;
|
||||
in
|
||||
{
|
||||
options.my.hardware.mx-ergo = with lib; {
|
||||
enable = mkEnableOption "MX Ergo configuration";
|
||||
options.my.hardware.trackball = with lib; {
|
||||
enable = mkEnableOption "trackball configuration";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
|
@ -13,6 +13,7 @@ in
|
|||
# This section must be *after* the one configured by `libinput`
|
||||
# for the `ScrollMethod` configuration to not be overriden
|
||||
inputClassSections = lib.mkAfter [
|
||||
# MX Ergo
|
||||
''
|
||||
Identifier "MX Ergo scroll button configuration"
|
||||
MatchProduct "MX Ergo"
|
||||
|
|
@ -11,7 +11,7 @@ in
|
|||
my.hardware = {
|
||||
ergodox.enable = true;
|
||||
|
||||
mx-ergo.enable = true;
|
||||
trackball.enable = true;
|
||||
};
|
||||
|
||||
# MTP devices auto-mount via file explorers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue