Sure. Homeserver software doesn't care where it's hosted. If you want it to federate with other homeservers on the Internet, it will need to be accessible from outside your local network, of course.
I'm not sure exactly what you're asking. The only practically usable homeserver software right now is Synapse (https://github.com/matrix-org/synapse), an implementation in Python built by the Matrix core developer team.
I somehow didn't process the "it's a smartphone part" and completely misunderstood his question as a result. I'll edit my original reply to correct that. Edit: Apparently I can't edit it anymore. :{