summaryrefslogtreecommitdiff
path: root/modules/hardware
diff options
context:
space:
mode:
authorseth <[email protected]>2023-04-17 12:00:55 -0400
committerseth <[email protected]>2023-04-17 12:01:21 -0400
commit92ca826539092f33c8e19a19c7a9ea0def2aece0 (patch)
treec6ff98c3f645f189b559bc1a69904fec217a946c /modules/hardware
parent98921a299be9f22bde9204e1fd05d0ea0fb0c6ed (diff)
move most configurations to modules
Diffstat (limited to 'modules/hardware')
-rw-r--r--modules/hardware/default.nix18
-rw-r--r--modules/hardware/nvidia.nix33
2 files changed, 51 insertions, 0 deletions
diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix
new file mode 100644
index 0000000..00f3169
--- /dev/null
+++ b/modules/hardware/default.nix
@@ -0,0 +1,18 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.myHardware;
+ inherit (lib) mkEnableOption mkIf;
+in {
+ options.myHardware.enable = mkEnableOption "hardware module";
+
+ imports = [
+ ./nvidia.nix
+ ];
+
+ config = mkIf cfg.enable {
+ hardware.enableAllFirmware = true;
+ };
+}
diff --git a/modules/hardware/nvidia.nix b/modules/hardware/nvidia.nix
new file mode 100644
index 0000000..12f6550
--- /dev/null
+++ b/modules/hardware/nvidia.nix
@@ -0,0 +1,33 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ cfg = config.myHardware.nvidia;
+ inherit (lib) mkEnableOption mkIf;
+in {
+ options.myHardware.nvidia.enable = mkEnableOption "enable nvidia support";
+
+ config = mkIf cfg.enable {
+ myHardware.enable = true;
+
+ hardware = {
+ nvidia = {
+ package = config.boot.kernelPackages.nvidiaPackages.stable;
+ modesetting.enable = true;
+ };
+
+ opengl = {
+ enable = true;
+ # make steam work
+ driSupport32Bit = true;
+ extraPackages = with pkgs; [
+ vaapiVdpau
+ ];
+ };
+ };
+
+ services.xserver.videoDrivers = ["nvidia"];
+ };
+}