I think I might be missing a point with the following macro. It aims to create a proc and I want it to create a variable in the global scope:
import macros
macro testing(name:static[string]; value:int): untyped =
  var tmp = newIdentNode(name)
  result = quote do:
    proc myProc() =
       var `tmp` {.global.} = `value`
var id {.compiletime.} = "hola"
testing(id, 2)
myProc()
echo hola  # <--FAILS
On the other hand, the following works:
import macros
macro testing(name:static[string]; value:int): untyped =
  var tmp = newIdentNode(name)
  result = quote do:
    #proc myProc() =
    var `tmp` {.global.} = `value`
var id {.compiletime.} = "hola"
testing(id, 2)
#myProc()
echo hola  # <--FAILS
Maybe I am not understanding the purpose of {.global.}.
From https://nim-lang.org/docs/manual.html#pragmas-global-pragma:
The global pragma can be applied to a variable within a proc to instruct the compiler to store it in a global location and initialize it once at program startup.
So it's just a way to have a variable initialize only once without adding a separate variable for caching.