I took this 3 years ago with an inter-rail pass- but I believe it costs approx 25 euros if you buy in Krakow- that is without a couchet (sleeping compartment- very comfy) which cost around 40 euros.
I did it a couple of years ago and it was cheap. you will probably be in a train with narrow corridors and fairly big compartments. Find one that is empty and sleep away. A great way to travel.