From nit + -y. The “foolish, inane” adjective sense is from nit, possibly under the influence of nutty.
The origin of the noun sense (“dope fiend, druggie”) is Unknown, but could refer to a person who is under the influence of drugs to the extent that he or she is careless about personal hygiene and unkempt. Compare the verb nit.