anchor.diff:            Extra configuration. Overrides any other cofiguration.
           '';
         };
  +
  +      configFile = mkOption {
  +        type = types.string;
  +        default = "/var/lib/couchdb/couchdb.ini";
  +        description = ''
  +          Custom configuration file. File needs to be readable and writable
  +          from couchdb user/group.
  +        '';
  +      };
  +
       };
   
     };
  
positive.code:         mkdir -p `dirname ${cfg.logFile}`;
          mkdir -p ${cfg.databaseDir};
          mkdir -p ${cfg.viewIndexDir};
  
          if [ "$(id -u)" = 0 ]; then
            chown ${cfg.user}:${cfg.group} `dirname ${cfg.uriFile}`
            chown ${cfg.user}:${cfg.group} ${cfg.databaseDir}
            chown ${cfg.user}:${cfg.group} ${cfg.viewIndexDir}
          fi
          '';
  
  
negative.code:         PermissionsStartOnly = true;
          User = cfg.user;
          Group = cfg.group;
          ExecStart = "${cfg.package}/bin/couchdb -a ${configFile} -a ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig} -a ${cfg.configFile}";
        };
      };
  
  