Why do you think it doesn't work? I think it's likely that you've some test with nim r myprog and Unix ctrl-c behavior is confusing you, with SIGINT responded to both by your program and by the nim compiler that's still waiting for your program to exit. Try nim c myprog; ./myprog.
There is a definition in system.nim, but the one you probably want to look at is in lib/system/excpt.nim
A test:
from posix import pause
proc exitProc {.noconv.} =
echo "hi"
quit(0)
setControlCHook(exitProc)
discard pause()
which works:
$ nim --hints:off c ctrlc; ./ctrlc
^Chi
$ nim --hints:off r ctrlc
^Chi
Traceback (most recent call last)
/__w/choosenim/choosenim/src/choosenimpkg/proxyexe.nim(62) proxyexe
/__w/choosenim/choosenim/src/choosenimpkg/proxyexe.nim(49) main
/__w/choosenim/choosenim/nimDir/lib/pure/osproc.nim(1397) waitForExit
SIGINT: Interrupted by Ctrl-C.