Feasibility:
Your design is almost identical to a regular gun, except, they use a small chemical reaction (a small explosion) to propel the bullet, instead of a nuclear one. So, scaling this up, there's hope for the nuclear case. Also, according to this, roughly 40~50% energy is blast energy (much better than I thought), while the rest goes to thermal energy and other kinds of energy. In a high pressure environment, with a low yield bomb, the blast energy can be further increased to 50%~70%.
Because we can engineer the environment, we can start with the projectile, staying in a tube filled with a gas/atmosphere maintained at a high pressure.
If the initial explosion is made extremely symmetric, one could even use reflections of the shock waves when hitting the wall to further increase directivity of the blast energy, and decrease damage to the ship itself.
In addition to the blast itself, the gas behind the bullet will expand, creating big pressures on it, further pushing the projectile (and the ship).
Design Calculations:
Now, this is a closed system (at least initially). We'll use the first law of thermodynamics: $U = Q + W$, the internal energy is work plus heat. We're interested in work. The initial internal energy of the system is negligible compared to the final one (bomb exploded), so we can consider $U$ to be the energy output of the bomb itself. We'll call the ratio between work and total energy as $\eta$. That is, $W = \eta U$. This work, will be effectively transformed into kinetic energy.
The remaining energy will go to heat:
$$
Q = (1-\eta)U = mc_v\Delta T = \rho V c_v\delta T
\quad\implies\quad
\Delta T = \frac{(1 - \eta)U}{\rho V}
$$
Where $c_v$ is the specific heat of our gas at constant volume, and $V$ is the volume in between the projectile and the bomb. From there, we can calculate the pressure:
$$
\frac{P_1}{P_0} = \frac{T_1}{T_0} = 1 + \frac{\Delta T}{T_0}
$$
While the initial pressure can be estimated using ideal gas law, namely $P_0 = \rho\frac{k_B}{m_g} T_0$, where $m_g$ is the mass of each molecule/particle of gas.
So, now we find final temperature and final pressure:
$$
\Delta T = \frac{(1 - \eta)UT_0 k_B}{P_0 m_g V},\quad\quad
P_1 = 1 + \frac{(1 - \eta)U k_B}{P_0 m_g V}
$$
The force applied on the projectile by the pressure is simply $F = m_p a = A P_1$, where $A$ is the cross section area of the projectile, $m_p$ is the mass, $a$ is the acceleration. Now we have a rough crude (possibly imprecise) of the acceleration, and thus, how quickly the projectile will leave the ship (as compared with, say, how quickly will be the explosion itself).
I am actually very lazy to plug some numbers and actually come up with a design that might work. I tried $V_0=10\times 10\times 10 m^3, P_0 = 10atm, U = 25MT, \eta = 10\%$ with a nitrogen atmosphere $m_g = 2.341\cdot 10^{-26} Kg$. This gives me $T_1\approx 1.643\cdot 10^{13}K$ and $P_1 = 54.779 GPa$. This gives a force of ~5470 giganewtons and acceleration of 5.47 billion meters per second squared (quite fast!) for a projectile with a ton of mass and 10x10 meter squared cross section.
With the velocity estimates below, one can calculate exactly how much time the projectile will stay in the ship. A 42.606 gigapascal pressure is already close the young's modulus of several materials, and already a bit beyond the shear modulus of, say, several titanium alloys: the ship won't survive. You might want to decrease the bomb's yield and play around with these equations. You might also want to check if the projectile itself will survive such huge accelerations (probably won't).
Conclusion: It might be feasible, but definitely not for a 25 megaton explosion. Maybe one could consider a one ton explosion and see what happens.
Velocity Estimate:
If we ignore the usual common sense explanation that one shouldn't use nuclear explosions to propel a projectile.... and focus on what speed we could get.. well.. let's start, I guess.
First, we have conservation of momentum: $\mathbf p_s + \mathbf p_p = 0$, assuming we are in the reference frame that the ship was initially at rest. Second, we have conservation of energy:
$$
U = K_S + K_P + Q
$$
Where $U$ is the total energy of the bomb, $K_P$ is the kinetic energy of the projectile, and $K_S$ the kinetic energy of the ship (or the total sum of kinetic energy of all the wreckage left by the ship). And, lastly, $Q$ is the thermal energy.
Now, it is important to notice that these two equations are valid for any and all given times. Because of that, we'll take a time where the projectile is launched, but the nuclear exposion didn't have enough time to completely destroy the ship itself (by too much). Thus, the ship is still in one piece, and thus, we are talking about a two-body system. That will greatly simplify everything.
Newtonian Calculations:
Let $v_p, v_s$ the velocity of projectile and ship. By momentum conservation, we know:
$$
m_s v_s = -m_p v_p
\quad\implies\quad
v_s = -\frac{m_p}{m_s}v_p
$$
Thus, the energy:
$$
K =
\frac{1}{2}m_s v_s^2 + \frac{1}{2}m_p v_p^2 =
\frac{1}{2}m_s\left(-\frac{m_p}{m_s}v_p\right)^2 + \frac{1}{2}m_p^2
$$
Thus:
$$
K = \frac{1}{2}\left(m_s + \frac{m_p^2}{m_s}\right)v_p^2
= \frac{1}{2}m_s\left[1 + \left(\frac{m_p}{m_s}v_p\right)^2\right]
$$
There, the projectile velocity is simply:
$$
v_p = \frac{m_s}{m_p}\sqrt{\frac{2K}{m_s} - 1}
$$
Where $U = Q + K$. Now it would be a matter of estimating the ratio between kinetic and total energy available, or, the efficiency $\eta = K/U$ of your transformation between bomb's energy to kinetic energy.
Plugging numbers: If $U = 25MT = 1.046\cdot 10^{17}J$, setting $\eta = 0.1\%$, this means $K = 1.046\cdot 10^{14}J$. If $m_s = 10^9 Kg$ and $m_p = 10^3 Kg$, then: $v_p = 1.5257c$. Faster than the speed of light!
Relativistic Calculations:
Lately, our result gave something faster than $c$, so, we conclude newton's mechanics do not apply. We need relativistic calculations to figure out the speed.
The relativistic total energy of the system is, then:
$$
E = \sqrt{(m_p c^2)^2 + (p_p c)^2} + \sqrt{(m_s c^2)^2 + (p_s c)^2}
$$
Where, by conservation of momentum, $p_p + p_s = 0$, which simplifies everything. Define $p = p_p = -p_s$ the relativistic momentum we wish to find.
Thus, we can solve for $p$:
$$
p^2 = \frac{1}{4}\left[\frac{E}{c} + \frac{c^3}{E}\left(m_p^2 - m_s^2\right)\right]^2 - m_p^2 c^2
$$
Now, using the relativistic momentum, $p$ is related with the velocity:
$$
p = \frac{m_p v_p}{\sqrt{1 - \frac{v_p^2}{c^2}}}
$$
And therefore, one can easily solve for $v_p$:
$$
v_p^2 = \frac{p^2}{m_p^2 + \frac{p^2}{c^2}} =
\frac{1}{\left(\frac{m_p}{p}\right)^2 + \frac{1}{c^2}}
$$
Therefore, finally, the (relativistic corrected) velocity of the projectile is:
$$
v_p^2 = \frac{\displaystyle 1}{\displaystyle \frac{m_p^2}{\frac{1}{4}\left[\frac{E}{c} + \frac{c^3}{E}\left(m_p^2 - m_s^2\right)\right]^2 - m_p^2 c^2} + \frac{1}{c^2}}
$$
Where $E = K + (m_s + m_p)c^2$ and $K = \eta U$. Plugging the same values as before gives us the projectile speed: $v_p = 457,386 m/s = 0.0015257c$. This is the speed of the projectile under the given situation (ship one million tons, projectile one tons, 25 megatons explosion, 0.1% efficiency). You can use this formula to play around and plug other values.
Hopefully I made no mistakes. If I did, someone please point me out.
Be aware that all of this ignores the obvious problems of having a nuclear explosion to propel a bullet: if you have those problems solved, then this calculations gives you a rough speed estimate of the projectile. And keep in mind I completely guessed $\eta$ (such value will depend on the actual mechanism you have to transform the bomb's energy to kinetic energy).