Mobile redirect in nginx with query string

You are trying to do a negative match in regex to prevent rewrites when amp query argument is 1 in the request URL.

It is better to do this check with one more if block:

if ($arg_amp = 1) {
    set $mobile_rewrite do_not_perform;
}

Then your rewrite can be:

if ($mobile_rewrite = perform) {
    rewrite ^ $scheme://www.cnx-software.es$request_uri?amp=1 break;
}