diff options
author | Nikolay Amiantov <ab@fmap.me> | 2017-01-30 00:29:39 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2017-02-08 16:57:46 +0300 |
commit | 2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079 (patch) | |
tree | 6de8a1be9ead1d441b9cd1a6b84aa75065d9935d /nixos/modules/hardware | |
parent | 750e7ba0d958a08cdef16a2147263586a55a3e4d (diff) |
linuxPackages.nvidia_x11: refactor, build more from source
* Use libglvnd; * Compile nvidia-settings, nvidia-persistenced from source; * Generalize builder.
Diffstat (limited to 'nixos/modules/hardware')
-rw-r--r-- | nixos/modules/hardware/video/bumblebee.nix | 2 | ||||
-rw-r--r-- | nixos/modules/hardware/video/nvidia.nix | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/nixos/modules/hardware/video/bumblebee.nix b/nixos/modules/hardware/video/bumblebee.nix index fbf3f20885b52..3967137fcf8b5 100644 --- a/nixos/modules/hardware/video/bumblebee.nix +++ b/nixos/modules/hardware/video/bumblebee.nix @@ -77,7 +77,7 @@ in config = mkIf cfg.enable { boot.blacklistedKernelModules = [ "nvidia-drm" "nvidia" "nouveau" ]; boot.kernelModules = optional useBbswitch "bbswitch"; - boot.extraModulePackages = optional useBbswitch kernel.bbswitch ++ optional useNvidia kernel.nvidia_x11; + boot.extraModulePackages = optional useBbswitch kernel.bbswitch ++ optional useNvidia kernel.nvidia_x11.bin; environment.systemPackages = [ bumblebee primus ]; diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index b604d645132db..cf723d53269b1 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -27,6 +27,13 @@ let nvidia_x11 = nvidiaForKernel config.boot.kernelPackages; nvidia_libs32 = (nvidiaForKernel pkgs_i686.linuxPackages).override { libsOnly = true; kernel = null; }; + nvidiaPackage = nvidia: pkgs: + if !nvidia.useGLVND then nvidia + else pkgs.buildEnv { + name = "nvidia-libs"; + paths = [ pkgs.libglvnd nvidia.out ]; + }; + enabled = nvidia_x11 != null; in @@ -35,19 +42,19 @@ in config = mkIf enabled { services.xserver.drivers = singleton - { name = "nvidia"; modules = [ nvidia_x11 ]; libPath = [ nvidia_x11 ]; }; + { name = "nvidia"; modules = [ nvidia_x11.bin ]; libPath = [ nvidia_x11 ]; }; services.xserver.screenSection = '' Option "RandRRotation" "on" ''; - hardware.opengl.package = nvidia_x11; - hardware.opengl.package32 = nvidia_libs32; + hardware.opengl.package = nvidiaPackage nvidia_x11 pkgs; + hardware.opengl.package32 = nvidiaPackage nvidia_libs32 pkgs_i686; - environment.systemPackages = [ nvidia_x11 ]; + environment.systemPackages = [ nvidia_x11.bin nvidia_x11.settings nvidia_x11.persistenced ]; - boot.extraModulePackages = [ nvidia_x11 ]; + boot.extraModulePackages = [ nvidia_x11.bin ]; # nvidia-uvm is required by CUDA applications. boot.kernelModules = [ "nvidia-uvm" ]; |