You'd need to formally recognize open-source projects that the German state approves of, on a case-by-case basis.
And even then you have questions like "If Hans Reiser is sentenced to community service for killing his wife, can he satisfy that by working on reiserfs? How is that different from sentencing him to no punishment?"
It's obviously not something that is an appropriate remedy for all crimes.