Patrick Micheal Emmett O’Hara, of Meadowview Crescent, pleaded guilty to a total of 22 drugs offences between November 16 and December 17, last year.
They include possessing mephedrone with intent to supply and being concerned in an offer to supply mephedrone, cannabis and diazepam.
The 20-year-old also admitted simple possession of cannabis.
Derry Crown Court heard that police were dealing with a separate incident in the Rockmills complex.
A member of the public then reported to police that O’Hara had been acting ‘spaced out’ with white powder ‘caked’ around his nostrils.
Officers went to the 20-year-old’s flat and he had the appearance of being under the influence of illegal substances.
Police could also see white powder around his nose.
O’Hara’s flat was searched and officers found three bags of white powder from the grill of a cooker. A rolled up five pound note was also found, with traces of white powder on it and a mobile phone was seized.
The court heard O’Hara was arrested and had to be taken to hospital as a result of the drugs he had taken.
Police called with the 20-year-old two weeks and officers noticed the smell of mepehdrone coming from his flat.
A cannabis joint was on a coffee table and a further search of the flat was carried out.
Four bags of white powder was discovered in a dust cover for a smoke alarm. This was examined and found to be glucose, a substance sometimes used as a cutting agent.
The court told O’Hara’s mobile phone was examined and there were ‘extensive messages’ to around 20 different people relating to drug supply.
It was revealed the defendant has no relevant previous convictions.
Defence counsel Steven Mooney said the 20-year-old was using drugs at this time and began supplying drugs ‘to fund his own habit’.
However, he said O’Hara has been drug free throughout his time in custody and wants to avail of help once he is released.
Mr Mooney added his client ‘realises if he continues to use drugs not only will he end up in prison again, he will end up in the graveyard’.
Passing sentence, Judge Philip Babington said the ‘cases of supply will be met with an immediate custodial sentence to deter others. The fact that someone is an addict doesn’t excuse this conduct’.
The judge imposed a determinate 18 months sentence, nine months of which will be spent in custody and nine months on licence.