[Nix-dev] Re: [Nix-commits] SVN commit: nix - 18176 - eelco - in nixos/trunk/modules: services/x11 virtualisation

Nicolas Pierron nicolas.b.pierron at gmail.com
Fri Nov 6 09:55:03 CET 2009


On Fri, Nov 6, 2009 at 01:59, Eelco Dolstra <e.dolstra at tudelft.nl> wrote:
> Modified: nixos/trunk/modules/services/x11/xserver.nix
> ===================================================================
> --- nixos/trunk/modules/services/x11/xserver.nix        2009-11-05 23:47:53 UTC (rev 18175)
> +++ nixos/trunk/modules/services/x11/xserver.nix        2009-11-06 00:59:03 UTC (rev 18176)
> @@ -11,27 +11,29 @@
>   xorg = pkgs.xorg;
>
>
> -  # Map the video driver setting to a driver.
> +  # Map video driver names to driver packages.
>   knownVideoDrivers = {
> -    nvidia =     { modules = [ kernelPackages.nvidia_x11 ]; };
> -    nvidiaLegacy =     { modules = [ kernelPackages.nvidia_x11_legacy ]; };
> -    vesa =       { modules = [ xorg.xf86videovesa ]; };
> -    vga =        { modules = [ xorg.xf86videovga ]; };
> -    sis =        { modules = [ xorg.xf86videosis ]; };
> -    i810 =       { modules = [ xorg.xf86videoi810 ]; };
> -    intel =      { modules = [ xorg.xf86videointel ]; };
> -    nv =         { modules = [ xorg.xf86videonv ]; };
> -    ati =        { modules = [ xorg.xf86videoati ]; };
> -    openchrome = { modules = [ xorg.xf86videoopenchrome ]; };
> -    unichrome  = { modules = [ pkgs.xorgVideoUnichrome ]; };
> -    cirrus =     { modules = [ xorg.xf86videocirrus ]; };
> -    vmware =     { modules = [ xorg.xf86videovmware ]; };
> -    virtualbox = { modules = [ kernelPackages.virtualboxGuestAdditions ]; };
> +    ati          = { modules = [ xorg.xf86videoati ]; };
> +    cirrus       = { modules = [ xorg.xf86videocirrus ]; };
> +    i810         = { modules = [ xorg.xf86videoi810 ]; };
> +    intel        = { modules = [ xorg.xf86videointel ]; };
> +    nv           = { modules = [ xorg.xf86videonv ]; };
> +    nvidia       = { modules = [ kernelPackages.nvidia_x11 ]; };
> +    nvidiaLegacy = { modules = [ kernelPackages.nvidia_x11_legacy ]; name = "nvidia"; };
> +    openchrome   = { modules = [ xorg.xf86videoopenchrome ]; };
> +    sis          = { modules = [ xorg.xf86videosis ]; };
> +    unichrome    = { modules = [ pkgs.xorgVideoUnichrome ]; };
> +    vesa         = { modules = [ xorg.xf86videovesa ]; };
> +    virtualbox   = { modules = [ kernelPackages.virtualboxGuestAdditions ]; name = "vboxvideo"; };
> +    vmware       = { modules = [ xorg.xf86videovmware ]; };
>   };
>
> -  videoDriver = cfg.videoDriver;
> +  driverNames =
> +    optional (cfg.videoDriver != null) cfg.videoDriver ++ cfg.videoDrivers;
>
> -  videoDriverInfo = attrByPath [videoDriver] (throw "unknown video driver: `${videoDriver}'") knownVideoDrivers;
> +  drivers = flip map driverNames
> +    (name: { inherit name; } //
> +      attrByPath [name] (throw "unknown video driver `${name}'") knownVideoDrivers);
>
>
>   fontsForXServer =
> @@ -377,16 +385,15 @@
>             done
>
>             rm -f /var/run/opengl-driver
> -            ${if videoDriver == "nvidia"
> -              then ''
> +            ${# !!! The OpenGL driver depends on what's detected at runtime.
> +              if elem "nvidia" driverNames then ''
>                 ln -sf ${kernelPackages.nvidia_x11} /var/run/opengl-driver
>               ''
> -             else if videoDriver == "nvidiaLegacy"
> -              then ''
> +             else if elem "nvidiaLegacy" driverNames then ''
>                 ln -sf ${kernelPackages.nvidia_x11_legacy} /var/run/opengl-driver
>               ''
> -              else if cfg.driSupport
> -              then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
> +              else if cfg.driSupport then
> +                "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
>               else ""
>              }
>
> @@ -423,86 +433,72 @@
>         EndSection
>
>         Section "Monitor"
> +          Identifier "Monitor[0]"
>           ${cfg.monitorSection}
>         EndSection
>
> -        Section "Device"
> -          ${cfg.deviceSection}
> -        EndSection
> -
>         Section "ServerLayout"
> +          Identifier "Layout[all]"
>           ${cfg.serverLayoutSection}
> +          # Reference the Screen sections for each driver.  This will
> +          # cause the X server to try each in turn.
> +          ${flip concatMapStrings drivers (d: ''
> +            Screen "Screen-${d.name}[0]"
> +          '')}
>         EndSection
>
> -        Section "Screen"
> -          Identifier "Screen[0]"
> -          Device "Device[0]"
> -          Monitor "Monitor[0]"
> +        # For each supported driver, add a "Device" and "Screen"
> +        # section.
> +        ${flip concatMapStrings drivers (driver: ''
> +
> +          Section "Device"
> +            Identifier "Device-${driver.name}[0]"
> +            Driver "${driver.name}"
> +            ${optionalString (driver.name == "nvidiaLegacy") ''

I guess this case cannot happen because you have added a name
attribute the the nvidiaLegacy video driver.

> +              # This option allows suspending with a nvidiaLegacy card
> +              Option "NvAGP" "1"
> +            ''}
> +            ${cfg.deviceSection}
> +          EndSection
>



-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
Andrew S. Tanenbaum - Never underestimate the bandwith of a wagon full of tapes.



More information about the nix-dev mailing list