I'll bump this thread. I can directly answer your question, but it won't get you all the way home.
ninfs will let you open your DSiWare CIAs and the NDS file is just sitting in the directory waiting to be pulled out.
However, when I do this Twilight doesn't seem to read it, or more specifically, Twilight in no$gba doesn't read it. It reads native NDS files just fine. There may be more steps I'm overlooking than just extracting the NDS directly.