The geological processes that lead to the formation of minerals, including igneous, sedimentary, and metamorphic processes.