How do I fit a joist in this small space?
There is a simple answer to this.  Cut the angle matching the roof on the ceiling joist, slide it in on top of your wall and attach it to the side of the rafter. Then attach them together with small lags or carriage bolts. If you look at your picture the 8" joist will be in contact with the rafter well beyond your walls.  The rafters will help carry the weight of the floor joists through the rafters down to the walls.  

Don't worry about the rafters, you will be applying the weight soo close to the wall it will not put more stress on your rafters. 

Construction adhesive would be a good idea too.  Your Lag spacing may vary depending on the thickness of your rafter.  Keep lags 2" from all edges and 3" from each other.  Pre drill all the holes you don't want to risk splitting your rafter. Lags should be 3/8" or less.  There is also of high strength screws/ lags that are smaller but just as strong as a standard lags that would work good.