I haven't tried Modafinil personally myself but my sister has and still uses it and it does help her sleep and she hasn't had any complications from it so far and she's been taking it for at least a year.
If you do notice any complications from it you should let your doctor know and also avoid drinking alcohol when taking modafinil because it can cause some serious health issues.
The sleep medicine Modafinil does not improve your brain health though and does not make you smarter but it does help you sleep when taken as directed by the doctor.
Do not take more than prescribed and always speak with your doctor if you notice any side effects when taking the modafinil.