Here's what you did in the derivation actually.
You derived the lens law for a special case. i.e. for a particular position of the lens, object and image. Like image on right of the lens and object on left or vice-versa.
Now the lens formula that you got was for this particular scenario.
Now suppose you apply the sign convention on this formula once again, the sign convention you applied in the derivation will be cancelled.
It is like if 'u' is negative in your formula, applying another '-' will cancel the effect and give you the general lens formula that will hold in all situations.
Its kind of like applying sign convention gives a particular formula and applying it twice cancels the effect of the sign convention at all,giving you the general lens formula.
This general lens formula is what you were after which you can use in other special scenarios by applying the sign convention.
If you want to see what I am saying, try deriving the lens formula, using these two conditions.
(1) image on right and object on left of lens.
(2) image on left and object on left.
BTW, do you know why you use sign convention in the first place ?
Because the formula can't distinguish otherwise between right and left, as you primarily using only magnitude of lengths in the derivation through similar triangles.
Also, do you know a virtual image is kind of an optical illusion only, as to there is nothing there behind the mirror.
In starting it is futile, but if you use many mirrors, you will get mad.
Actually, you have derived your formula in a particular case, say when image is behind the mirror. To extrapolate it to other cases, you say that you could have used opposite sign of image distance.
But this will create different formulas for different cases as distance is always positive. To avoid a large number of these formulas, we united and decided that positive is in this direction and negative in that one. Now, all of our formulas agree and we live happily together
Best Answer
There are actually two different sign conventions in optics. Without any convention it's hard to develop any universal scientific statement (like formula) so let's make up one here:
1. Cartesian sign convention
Small lens formula:
$$\frac1s-\frac1d=\frac1F$$
Interpretation: "curvature after - curvature before = curvature added". This convention is widely accepted by professional opticians as it employs idea of "positive = co-propagating with left-to-right ray direction".
2. "Classic" scholar sign convention
Small lens formula:
$$\frac1s+\frac1d=\frac1F$$
$s>0$ and $d>0$ if the image and objects are real and both are negative if both are virtual.
3. Without any sign convention you would have to use formula like this one:
$$\pm\frac1s\pm\frac1d=\pm\frac1F$$
Depending on the type of lens and object position:
Sources:
The longitudinal lens formula and sign conventions
Правила знаков (в оптике) on Russian Wikipedia