Here is an article from an online, peer-reviewed journal that discusses motivating factors in open-source software.
The goal of the study on Fun and Software Development (FASD) is to precisely assess the importance that fun has as motivation for software developers to engage in open source projects. A survey carried out both under open source developers and programmers working in Swiss software companies yielded that the fun motive accounts for about 27 percent to 33 percent of open source developers’ motivation.
Fun is a pervasive feature of software development, not only for open source programmers but in the area of commercial software development too: Open source developers that are paid for their work are observed to be very motivated and prepared for future effort, especially if they enjoy their development time. Furthermore, the fun that programmers experience functions as a good proxy for their productivity. Therefore, employers that want to enhance the programmers’ productivity can safely invest in an environment of fun for developers in their company.