anchor.diff:    };
   
     xinit = attrs: attrs // {
  -    stdenv = if isDarwin then args.clangStdenv else stdenv;
  -    buildInputs = attrs.buildInputs ++ lib.optional isDarwin args.bootstrap_cmds;
  +    stdenv = if stdenv.cc.isClang then args.clangStdenv else stdenv;
  +    buildInputs = attrs.buildInputs;
       configureFlags = [
         "--with-xserver=${xorg.xorgserver}/bin/X"
  -    ] ++ lib.optionals isDarwin [
  -      "--with-bundle-id-prefix=org.nixos.xquartz"
  -      "--with-launchdaemons-dir=\${out}/LaunchDaemons"
  -      "--with-launchagents-dir=\${out}/LaunchAgents"
       ];
  -    propagatedBuildInputs = [ xorg.xauth ]
  -                         ++ lib.optionals isDarwin [ xorg.libX11 xorg.xproto ];
  +    propagatedBuildInputs = [ xorg.xauth ];
       prePatch = ''
         sed -i 's|^defaultserverargs="|&-logfile \"$HOME/.xorg.log\"|p' startx.cpp
       '';
  
positive.code:       ];
        # fix_segfault: https://bugs.freedesktop.org/show_bug.cgi?id=91316
        commonPatches = [ ./xorgserver-xkbcomp-path.patch ];
        # XQuartz requires two compilations: the first to get X / XQuartz,
        # and the second to get Xvfb, Xnest, etc.
        darwinOtherX = overrideDerivation xorgserver (oldAttrs: {
          configureFlags = oldAttrs.configureFlags ++ [
            "--disable-xquartz"
            "--enable-xorg"
            "--enable-xvfb"
            "--enable-xnest"
            "--enable-kdrive"
          ];
          postInstall = ":"; # prevent infinite recursion
        });
      in
        if (!isDarwin)
        then {
          buildInputs = [ makeWrapper ] ++ commonBuildInputs;
          propagatedBuildInputs = [ libpciaccess pixman ] ++ commonPropagatedBuildInputs ++ lib.optionals stdenv.isLinux [
            args.udev
  
negative.code:         # Remove useless DocBook XML files.
          rm -rf $out/share/doc
        '';
      CPP = stdenv.lib.optionalString stdenv.cc.isClang "clang -E -";
      outputs = [ "out" "man" ];
    };
  
  