a75c64d04a
This puts a hard dependency on 20.09, but that's to be expected.
26 lines
649 B
Nix
26 lines
649 B
Nix
{ options, config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
with lib.my;
|
|
let cfg = config.modules.hardware.nvidia;
|
|
in {
|
|
options.modules.hardware.nvidia = {
|
|
enable = mkBoolOpt false;
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
hardware.opengl.enable = 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"
|
|
'')
|
|
];
|
|
};
|
|
}
|