nvidia module

This commit is contained in:
Sakooooo 2023-07-08 19:23:36 +03:00
parent f90cb7bac8
commit d71a339a18
Signed by: sako
GPG key ID: 3FD715D87D7725E0
5 changed files with 56 additions and 33 deletions

View file

@ -10,6 +10,7 @@
# add entry to module's default.nix
outputs.nixosModules.desktop
outputs.nixosModules.shell
outputs.nixosModules.hardware
];
# flakes

View file

@ -24,6 +24,9 @@
kitty.enable = true;
bspwm.enable = true;
};
hardware = {
nvidia.enable = true;
};
shell = {
nix = {
# makes nix search nixpkgs <example>
@ -33,39 +36,6 @@
};
};
# Nvidia Drivers
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# tell xserver i want this driver
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
# wayland support cause why not
modesetting.enable = true;
# TODO(sako):: add this as a cfg option for hosts
open = false;
# settings
nvidiaSettings = true;
# Package
package = config.boot.kernelPackages.nvidiaPackages.stable;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# Bluetooth
hardware.bluetooth = {
enable = true;

View file

@ -1,4 +1,5 @@
{
desktop = import ./desktop;
shell = import ./shell;
hardware = import ./hardware;
}

View file

@ -0,0 +1,5 @@
{
imports = [
./nvidia
];
}

View file

@ -0,0 +1,46 @@
{ outputs, options, config, lib, pkgs, ...}:
with lib;
let
cfg = config.modules.hardware.nvidia;
in
{
options.modules.hardware.nvidia = {
enable = mkEnableOption false;
};
config = mkIf cfg.enable {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
# wayland support
modesetting.enable = true;
# TODO(sako) add this as a cfg option
# set to true if you have an rtx or newer graphics card
# else set to false
open = false;
# settings
nvidiaSettings = true;
# Package
package = config.boot.kernelPackages.nvidiaPackages.stable;
# TODO(sako) ALSO add these as a cfg option
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
};
}