Sedimentary rocks examined by the Curiosity rover at Yellowknife Bay, Mars, were derived from sources that evolved from an approximately average martian crustal composition to one influenced by alkaline basalts. No evidence of chemical weathering is preserved, indicating arid, possibly cold, paleoclimates and rapid erosion and deposition. The absence of predicted geochemical variations indicates that magnetite and phyllosilicates formed by diagenesis under low-temperature, circumneutral pH, rock-dominated aqueous conditions. Analyses of diagenetic features (including concretions, raised ridges, and fractures) at high spatial resolution indicate that they are composed of iron- and halogen-rich components, magnesium-iron-chlorine-rich components, and hydrated calcium sulfates, respectively. Composition of a cross-cutting dike-like feature is consistent with sedimentary intrusion. The geochemistry of these sedimentary rocks provides further evidence for diverse depositional and diagenetic sedimentary environments during the early history of Mars.