Use
dt-curve-tool-helper. It allows you to create a basecurve from a bunch of RAW jpeg pairs. The software is part of the source distribution of darktable but not always packaged by distro maintainers. This tool got me very close to perfectly replicating the jpgs.
Download the dartable source from the
darktable github (download zip) link on the right hand side. Then go into the the tools/basecurve subfolder of the unzipped darktable directory and open the README.md file. Or read it
at github here
Follow the instructions for dt-curve-tool-helper and load the settings into darktable using the output of the tool.
To avoid hassle take a bunch of landscape format images that contain as much range as you can. Blown highlights, underexposed blackness, colours, trees, people blurry photos sharp etc. I did this around the house with good results.
You can do this for any in camera settings despite the dartable website suggesting you use the bright camera setting.
To anyone wondering why go through the hassle replicating the jpg settings. Why not just shoot jpeg? The answer is that it allows fixing mistakes and recovering highlights in ways the camera can't. Having a good baseline to tweak from is excellent even when you end up doing quite radical changes.
And a tip: Try out the color setting in highlight recovery if you haven't already. I'ts quite amazing for some photographs (awful for others, watch out for odd coloured sky)