refactor: move nvidia specific settings into its own file
This commit is contained in:
parent
268e698221
commit
738451a09c
2 changed files with 39 additions and 26 deletions
38
modules/nvidia.nix
Normal file
38
modules/nvidia.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{ pkgs, config, inputs, ... }:
|
||||||
|
let
|
||||||
|
hyprland-pkgs = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
hardware = {
|
||||||
|
graphics = {
|
||||||
|
enable = true;
|
||||||
|
package = hyprland-pkgs.mesa.drivers;
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
nvidia-vaapi-driver
|
||||||
|
ocl-icd
|
||||||
|
cudaPackages.cudatoolkit
|
||||||
|
];
|
||||||
|
};
|
||||||
|
nvidia = {
|
||||||
|
open = true;
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.latest;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
videoDrivers = [ "nvidia" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.variables = {
|
||||||
|
NIXOS_OZONE_WL = "1"; # Hint to electron apps to use Wayland
|
||||||
|
LIBVA_DRIVER_NAME = "nvidia";
|
||||||
|
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||||
|
NVD_BACKEND = "direct"; # Set VAAPI driver backend
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
clinfo
|
||||||
|
pciutils
|
||||||
|
];
|
||||||
|
}
|
|
@ -3,12 +3,12 @@
|
||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
{ inputs, config, pkgs, ... }: let
|
{ inputs, config, pkgs, ... }: let
|
||||||
hyprland-pkgs = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system};
|
|
||||||
in {
|
in {
|
||||||
imports =
|
imports =
|
||||||
[ # Include the results of the hardware scan.
|
[ # Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
../../scripts/hyprland-tty-launch.nix
|
../../scripts/hyprland-tty-launch.nix
|
||||||
|
../../modules/nvidia.nix # Graphics settings for Nvidia GPUs
|
||||||
];
|
];
|
||||||
|
|
||||||
# Bootloader.
|
# Bootloader.
|
||||||
|
@ -22,30 +22,6 @@ in {
|
||||||
options = [ "rw" "uid=rafiq" ];
|
options = [ "rw" "uid=rafiq" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Graphics settings are defined here
|
|
||||||
hardware = {
|
|
||||||
graphics.enable = true;
|
|
||||||
graphics.package = hyprland-pkgs.mesa.drivers;
|
|
||||||
graphics.extraPackages = with pkgs; [
|
|
||||||
nvidia-vaapi-driver
|
|
||||||
ocl-icd
|
|
||||||
cudaPackages.cudatoolkit
|
|
||||||
# clinfo
|
|
||||||
];
|
|
||||||
nvidia = {
|
|
||||||
open = true;
|
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
environment.variables.NIXOS_OZONE_WL = "1"; # Hint to electron apps to use Wayland
|
|
||||||
environment.variables.LIBVA_DRIVER_NAME = "nvidia";
|
|
||||||
environment.variables.__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
|
||||||
environment.variables.NVD_BACKEND = "direct"; # Set VAAPI driver backend
|
|
||||||
|
|
||||||
services.xserver = {
|
|
||||||
enable = true;
|
|
||||||
videoDrivers = [ "nvidia" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Add hyprland.cachix.org as a binary cache for Hyprland
|
# Add hyprland.cachix.org as a binary cache for Hyprland
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
|
@ -112,7 +88,6 @@ in {
|
||||||
# $ nix search wget
|
# $ nix search wget
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
firefox
|
firefox
|
||||||
clinfo
|
|
||||||
koboldcpp
|
koboldcpp
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue