Roast the walnuts and almonds for 4-5 minutes. Allow it cool and grind them into smooth powder. Grease a plate/tray with ghee and keep it ready.
Heat a non stick pan over medium heat and add sugar and water. Mix well till sugar dissolves completely. Keep stirring and cook till one string consistency is reached. (See Notes)
Now add the walnut-badam powder and mix well. Keep stirring till the mixture starts to leave the sides of the pan.
At this stage add ghee and keep stirring until it thickens and forms a mass. Remove from heat and immediately pour into the greased tray.
Flatten the mixture with a spatula and allow it cool for few minutes. Cut into your desired shape while it is slightly warm.
Notes
To check one string consistency, wet your fingers and take a drop of syrup in between your thumb and index finger. If a single string is formed between the fingers, it means syrup has reached one string consistency.
The barfi was not too sweet, so if you want more sweet add 1 cup sugar.