Here is the chapter 13 reference:
https://www.csd.uoc.gr/~hy121/2013a/datasheets/ngspice-user-manual.pdfDo this.
Perform an operating point simulation.
Measure the voltage at Node A at full precision.
Break connection at wire B.
Add a voltage source (V1) to drive Node A with the value measured above.
Run another operating point simulation.
Measure the voltage at the output of the inverter to full precision.
Add a voltage source (V2) to drive the output of the inverter with the value just measured.
Convert the first voltage source (V1), above, to a SINE source with dc offset being the same as before. Set amplitude to 1mV. Set frequency to 100 Hz.
Run a transient simulation.
Measure current in the second voltage source, V2. This current divided by the input ac voltage is your GM.
I am pretty sure there is a better way to do this, and I will give it some thought, but this is one way.
This can be simplified by just making V2 the same dc value as V1 and skip the second operating-point simulation. The results will be practically the same.