Certain insect larvae can live solely on feces. They produce valuable proteins.
Technical waste water recycling is used on the ISS. It filters some chemicals out and provides fresh water as a result. Urine contains high levels of nitrogen and phosphorus and can be used to make fertilizers.