Catalysis of the reaction: S-adenosyl-L-methionine + histone L-lysine = S-adenosyl-L-homocysteine + histone N6-methyl-L-lysine. The methylation of peptidyl-lysine in histones forms N6-methyl-L-lysine, N6,N6-dimethyl-L-lysine and N6,N6,N6-trimethyl-L-lysine derivatives.