ati_unfree: Create a nixos module for the ati_unfree x11 driver and blacklist the radeon driver when ati_unfree is installed.

+41 -22
+2 -15
nixos/modules/hardware/opengl.nix
··· 104 104 environment.sessionVariables.LD_LIBRARY_PATH = 105 105 [ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ]; 106 106 107 - # FIXME: move this into card-specific modules. 108 - hardware.opengl.package = mkDefault 109 - (if elem "ati_unfree" videoDrivers then 110 - kernelPackages.ati_drivers_x11 111 - else 112 - makePackage pkgs); 113 - 107 + hardware.opengl.package = mkDefault (makePackage pkgs); 114 108 hardware.opengl.package32 = mkDefault (makePackage pkgs_i686); 115 109 116 - boot.extraModulePackages = 117 - optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions ++ 118 - optional (elem "ati_unfree" videoDrivers) kernelPackages.ati_drivers_x11; 119 - 120 - environment.etc = 121 - optionalAttrs (elem "ati_unfree" videoDrivers) { 122 - "ati".source = "${kernelPackages.ati_drivers_x11}/etc/ati"; 123 - }; 110 + boot.extraModulePackages = optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions; 124 111 }; 125 112 }
+37
nixos/modules/hardware/video/ati.nix
··· 1 + # This module provides the proprietary ATI X11 / OpenGL drivers. 2 + 3 + { config, lib, pkgs, pkgs_i686, ... }: 4 + 5 + with lib; 6 + 7 + let 8 + 9 + drivers = config.services.xserver.videoDrivers; 10 + 11 + enabled = elem "ati_unfree" drivers; 12 + 13 + ati_x11 = config.boot.kernelPackages.ati_drivers_x11; 14 + 15 + in 16 + 17 + { 18 + 19 + config = mkIf enabled { 20 + 21 + services.xserver.drivers = singleton 22 + { name = "fglrx"; modules = [ ati_x11 ]; libPath = [ "${ati_x11}/lib" ]; }; 23 + 24 + hardware.opengl.package = ati_x11; 25 + #hardware.opengl.package32 = pkgs_i686.linuxPackages.ati_x11.override { libsOnly = true; kernel = null; }; 26 + 27 + environment.systemPackages = [ ati_x11 ]; 28 + 29 + boot.extraModulePackages = [ ati_x11 ]; 30 + 31 + boot.blacklistedKernelModules = [ "radeon" ]; 32 + 33 + environment.etc."ati".source = "${ati_x11}/etc/ati"; 34 + 35 + }; 36 + 37 + }
+1
nixos/modules/module-list.nix
··· 38 38 ./hardware/pcmcia.nix 39 39 ./hardware/video/bumblebee.nix 40 40 ./hardware/video/nvidia.nix 41 + ./hardware/video/ati.nix 41 42 ./installer/tools/nixos-checkout.nix 42 43 ./installer/tools/tools.nix 43 44 ./misc/assertions.nix
+1 -5
nixos/modules/services/x11/xserver.nix
··· 13 13 14 14 # Map video driver names to driver packages. FIXME: move into card-specific modules. 15 15 knownVideoDrivers = { 16 - ati_unfree = { modules = [ kernelPackages.ati_drivers_x11 ]; driverName = "fglrx"; }; 17 16 nouveau = { modules = [ pkgs.xf86_video_nouveau ]; }; 18 17 unichrome = { modules = [ pkgs.xorgVideoUnichrome ]; }; 19 18 virtualbox = { modules = [ kernelPackages.virtualboxGuestAdditions ]; driverName = "vboxvideo"; }; ··· 444 443 pkgs.xterm 445 444 pkgs.xdg_utils 446 445 ] 447 - ++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh 448 - ++ optional (elem "ati_unfree" cfg.videoDrivers) kernelPackages.ati_drivers_x11; 446 + ++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh; 449 447 450 448 environment.pathsToLink = 451 449 [ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ]; ··· 465 463 XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime. 466 464 LD_LIBRARY_PATH = concatStringsSep ":" ( 467 465 [ "${xorg.libX11}/lib" "${xorg.libXext}/lib" ] 468 - ++ optionals (elem "ati_unfree" cfg.videoDrivers) 469 - [ "${kernelPackages.ati_drivers_x11}/lib" "${kernelPackages.ati_drivers_x11}/X11R6/lib64/modules/linux" ] 470 466 ++ concatLists (catAttrs "libPath" cfg.drivers)); 471 467 } // cfg.displayManager.job.environment; 472 468
-2
pkgs/os-specific/linux/ati-drivers/default.nix
··· 21 21 # There is one issue left: 22 22 # /usr/lib/dri/fglrx_dri.so must point to /run/opengl-driver/lib/fglrx_dri.so 23 23 24 - # You eventually have to blacklist radeon module (?) 25 - 26 24 assert stdenv.system == "x86_64-linux"; 27 25 28 26 stdenv.mkDerivation {