I assume that le devoir is derived from the verb devoir, as opposed to the other way around. Are there many other nouns derived from verbs, such that the noun is identical to the verb? Are these nouns always masculine?
There are plenty of such nouns:
To designate a period of time when people do a specific action in a day-to-day schedule (lever, déjeuner...)
To designate a specific notion, often (but not only) in philosophy, it can happen that a verb is directly used as a noun (l'être et le paraître, le savoir-faire, un avoir)
To designate a specific action (un lancer)
Some nouns are even perfect homonyms of verbs without a clear link between the two of them. Either one derived from the other a very long time ago or they just ended up being homonyms by the random of linguistic evolution (un boucher: a butcher, boucher: to clog)
As far as I know all these nouns are masculine, but I suspect you may find words of the last category that are feminine.
Your question is interesting, because I think the answer has to be precise:
The derivation of a verb to a noun car be either feminine or masculine when it is associated with a suffix: la dorure (from dorer), le garage (from garer), la parure (from parer), la moulure (from mouler), le codage (from coder).
But when the process consists of making the noun from the verb as it is, then the noun is always masculine: le coucher, le manger, le vouloir, le déjeûner, le dîner, le souper...
Yes there are many nouns derived from verbs :
Le bon vouloir Le coucher Le déjeuner / le dîner / le souper Le savoir
This pages affirms that infinitive verbs used as nouns are neither masculine nor feminine but neutral : http://research.jyu.fi/grfle/462.html I don't know if that can be trusted, but at least that sounds right.