anchor.diff:  { config, pkgs, ... }:
  -
  -with pkgs.lib;
  +  with pkgs.lib;
   
   let
  -
     cfg = config.services.couchdb;
     configFile = pkgs.writeText "couchdb.ini"
       ''
  
positive.code:         default = "couchdb";
          description = ''
            Group account under which couchdb runs.
          '';
        };
  
        pidFile = mkOption {
          type = types.path;
          default = "/var/run/couchdb/couchdb.pid";
          description = ''
            pid file.
          '';
        };
  
  
negative.code: 
        preStart =
          ''
          mkdir -p `dirname ${cfg.uriFile}`;
          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
          '';
  
        serviceConfig = {
          PermissionsStartOnly = true;
          User = cfg.user;
          Group = cfg.group;
          ExecStart = "${cfg.package}/bin/couchdb -a ${configFile} -a ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig}";
        };
      };
  
  