I am also unsure of what "nontriviality" conditions you want to impose. Without any further conditions, the following answers your question:
Call a positive integer $n$ nilpotent if every group of order $n$ is nilpotent.
Call a positive integer $n$ abelian if every group of order $n$ is abelian.
Suppose that the prime factorization of $n$ is $p_1^{a_1} \cdots p_r^{a_r}$. Then:
$n$ is nilpotent iff for all $i,j,k$ with $1 \leq k \leq a_i$, $p_i^k \not \equiv 1 \pmod{p_j}$.
$n$ is abelian iff it is nilpotent and $a_i \leq 2$ for all $i$.
These results are proved in
Pakianathan, Jonathan(1-WI); Shankar, Krishnan(1-MI) Nilpotent numbers. Amer. Math. Monthly 107 (2000), no. 7, 631--634.
The proofs are constructive: for any $n$ which is not nilpotent (resp. abelian), they give an explicit group of that order which is not nilpotent (resp. abelian).
The paper is available at
http://www.math.uga.edu/~pete/nilpotentnumbers.pdfhttp://alpha.math.uga.edu/~pete/nilpotentnumbers.pdf