The assembly of DNA, histone proteins, other associated proteins, and sometimes RNA, into chromatin structure, beginning with the formation of the basic unit, the nucleosome, followed by organization of the nucleosomes into higher order structures, ultimately giving rise to a complex organization of specific domains within the nucleus.