30 lines
820 B
Nix
30 lines
820 B
Nix
{ options, config, lib, pkgs, ... }:
|
|
with lib;
|
|
with lib.custom;
|
|
let
|
|
cfg = config.modules.hardware.nvidia;
|
|
in {
|
|
options.modules.hardware.nvidia = {
|
|
enable = mkBoolOpt false;
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
hardware.opengl = {
|
|
enable = true;
|
|
driSupport = true;
|
|
driSupport32Bit = true;
|
|
};
|
|
|
|
services.xserver.videoDrivers = [ "nvidia" ];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
# Respect XDG conventions, damn it!
|
|
(writeScriptBin "nvidia-settings" ''
|
|
#!${stdenv.shell}
|
|
mkdir -p "$XDG_CONFIG_HOME/nvidia"
|
|
exec ${config.boot.kernelPackages.nvidia_x11.settings}/bin/nvidia-settings --config="$XDG_CONFIG_HOME/nvidia/settings"
|
|
'')
|
|
];
|
|
};
|
|
}
|