What worked for me -- and I know it doesn't work for everyone, but it may work for you as well:
I used to bite my nails.
I decided to stop for one whole day. I made a conscious effort not to do so for the whole day. The next day I allowed myself to bite my nails.
Then i stopped for two days. Then I allowed myself to bite my nails for one day.
Then I stopped for fie days, and on the sixth I used a nail file to smooth the edges of my nails. I decided not to bite my nails for two days after that.
That was a whole week.
I told myself: If I can go a week, I can go two.
After two, I told myself I can go three without biting my nails.
After three weeks of not biting my nails, I allowed myself a day to do it again, and it hurt. My teeth hurt from it, my fingers and nails hurt from it, and I stopped on the first nail.
I marked a calendar that day and a future date: Not allowed for a month. At the end of the month, I no longer wanted to bite my nails.
I had to learn how to properly use nail clippers, since I had been biting my nails for so long. But I never wanted to bite them again.
Some say it takes 21 days of concerted effort to establish or break a habit.
Combine this with affirmations of determination. Don't replace nail biting with another habit; it will create a new dependency.
Learn to redirect your thoughts. When it's an embedded habit, it is almost a compulsion to do so. At first it takes direct thought not to bite them. After a bit, you can redirect your thoughts; you realize you're about to bite a nail, and you stop yourself, and repeat your affirmation, tell yourself to stop, or something. I don't remember what I had to tell myself.