Are you using the Nios II Linux Distribution? If you are, basic instructions can be found within the Quick Start Guide starting on Page 21. In short
(1) you need to compile uClibc against your current kernel project
(2) you then need to write up your C code and an appropriate Makefile in a sub-directory within ...altera/kits/nios2/examples/software/linux/apps
---
Take a look at ...altera/kits/nios2/examples/software/linux/apps/samples/hello as an example. Instructions for building the apps are in the quick start guide.
Application development under Nios II Linux is currently being integrated into Eclipse and will be made available in our next release and will simplify the process of building individual apps.