PortValhalla/lib/modules/hardware.nix
2024-11-29 01:13:58 +01:00

76 lines
2 KiB
Nix

{ config, lib, ... }:
let
inherit (lib) mkOption types;
optionalAttrs = lib.attrsets.optionalAttrs;
hw = config.valhalla.hardware;
in
{
options = {
valhalla = {
hardware = {
components = mkOption {
type = types.listOf types.str;
description = "The names of the hardware components of the computer.";
default = [ ];
};
surfaceBook = mkOption {
type = types.bool;
description = "A value indicating whether the system is a Surface Book 2.";
default = false;
};
xoneReceiver = mkOption {
type = types.bool;
description = "A value indicating whether an Xbox receiver is present.";
default = false;
};
eyeX = mkOption {
type = types.bool;
description = "A value indicating whether a Tobii EyeX device is present.";
default = false;
};
amdCPU = mkOption {
type = types.bool;
description = "A value indicating whether an AMD CPU is present.";
default = false;
};
nvidiaGPU = mkOption {
type = types.bool;
description = "A value indicating whether an NVIDIA GPU is present.";
default = false;
};
corsairDevice = mkOption {
type = types.bool;
description = "A value indicating whether a Corsair device is present.";
default = false;
};
elgatoWave = mkOption {
type = types.bool;
description = "A value indicating whether an Elgato Wave device is present.";
default = false;
};
};
};
};
config = {
valhalla = {
linux.programs = (optionalAttrs hw.nvidiaGPU {
nvidia-dkms.enable = true;
}) // (optionalAttrs hw.xoneReceiver {
xone.enable = true;
});
windows.programs = (optionalAttrs hw.eyeX {
tobii-gamehub.enable = lib.mkDefault true;
tobii-ghost.enable = lib.mkDefault true;
});
};
};
}