anchor.diff:      ZM_DB_TYPE=mysql
       ZM_DB_HOST=${cfg.database.host}
       ZM_DB_NAME=${cfg.database.name}
  -    ZM_DB_USER=${if cfg.database.createLocally then user else cfg.database.username}
  +    ZM_DB_USER=${cfg.database.username}
       ZM_DB_PASS=${cfg.database.password}
   
       # Web
  
positive.code:           procps
            psmisc
          ];
          after = [ "mysql.service" "nginx.service" ];
          wantedBy = [ "multi-user.target" ];
          restartTriggers = [ defaultsFile configFile ];
          preStart = lib.mkIf useCustomDir ''
            install -dm775 -o ${user} -g ${group} ${cfg.storageDir}/{${lib.concatStringsSep "," libDirs}}
          '';
          serviceConfig = {
            User = user;
  
negative.code:   };
  
    config = lib.mkIf cfg.enable {
  
      assertions = [
        { assertion = cfg.database.createLocally -> cfg.database.username == user;
          message = "services.zoneminder.database.username must be set to ${user} if services.zoneminder.database.createLocally is set true";
        }
      ];
  
      environment.etc = {
        "zoneminder/60-defaults.conf".source = defaultsFile;
  