anchor.diff:        default = false;
         type = types.bool;
         description = ''
  -        If true, enable gitweb in nginx. Access it at http://yourserver/gitweb
  +        If true, enable gitweb in nginx.
  +      '';
  +    };
  +
  +    location = mkOption {
  +      default = "/gitweb";
  +      type = types.str;
  +      description = ''
  +        Location to serve gitweb on.
  +      '';
  +    };
  +
  +    user = mkOption {
  +      default = "nginx";
  +      type = types.str;
  +      description = ''
  +        Existing user that the CGI process will belong to. (Default almost surely will do.)
  +      '';
  +    };
  +
  +    group = mkOption {
  +      default = "nginx";
  +      type = types.str;
  +      description = ''
  +        Group that the CGI process will belong to. (Set to <literal>config.services.gitolite.group</literal> if you are using gitolite.)
  +      '';
  +    };
  +
  +    virtualHost = mkOption {
  +      default = "_";
  +      type = types.str;
  +      description = ''
  +        VirtualHost to serve gitweb on. Default is catch-all.
         '';
       };
   
     };
   
  -  config = mkIf config.services.nginx.gitweb.enable {
  +  config = mkIf cfg.enable {
   
       systemd.services.gitweb = {
         description = "GitWeb service";
  
positive.code:         FCGI_SOCKET_PATH = "/run/gitweb/gitweb.sock";
        };
        serviceConfig = {
          User = "nginx";
          Group = "nginx";
          RuntimeDirectory = [ "gitweb" ];
        };
        wantedBy = [ "multi-user.target" ];
      };
  
      services.nginx = {
        virtualHosts.default = {
          locations."/gitweb/static/" = {
            alias = "${package}/static/";
          };
          locations."/gitweb/" = {
            extraConfig = ''
              include ${pkgs.nginx}/conf/fastcgi_params;
              fastcgi_param GITWEB_CONFIG ${cfg.gitwebConfigFile};
              fastcgi_pass unix:/run/gitweb/gitweb.sock;
            '';
          };
  
negative.code: with lib;
  
  let
    cfg = config.services.nginx.gitweb;
    gitwebConfig = config.services.gitweb;
    package = pkgs.gitweb.override (optionalAttrs gitwebConfig.gitwebTheme {
      gitwebTheme = true;
    });
  
  