Change:
substituteInPlace $f --replace @ZM_CONFIG_SUBDIR@ /etc/zoneminder done <del> for f in includes/Event.php views/image.php skins/classic/views/image-ffmpeg.php ; do substituteInPlace web/$f  --replace "'ffmpeg " "'${ffmpeg}/bin/ffmpeg " done </del> <ins> for f in includes/Event.php views/image.php ; do substituteInPlace web/$f  --replace "'ffmpeg " "'${ffmpeg}/bin/ffmpeg " done substituteInPlace web/includes/functions.php  --replace "'date " "'${coreutils}/bin/date "  --subst-var-by srcHash "`basename $out`" </ins> ''; buildInputs = [

Discussion:
Zoneminder, but it seems there is no code that handles upgrades, while that is provided by upstream and for example the Ubuntu packaging. It seems to be more of a developer preview version on NixOS than something that could be used by end-users in a production environment. I would have a flag like that needs to be set to true before it does something for that reason. I welcome the progress that has been made, but it doesn't appear to be in good enough shape to compete with other solutions. I will open another issue for adding declarative camera support (), because there was another user who also wanted to have that, which should also make this issue smaller.
Looking at zoneminder_1.30.4+dfsg- in debian/TODO.Debian it says: and there is no mention of the in the scripts. Are you sure Ubuntu has support for this? My personal opinion is that automatic upgrades are not such a great thing. While there are provided migrations to upgrade the database, there doesn't seem to be an official way to downgrade. This conflicts with the nature of Nix where we expect seamless version changes in any direction. Having user manually run ensures that they are aware of the upgrade and prepared for consequences.
has recently changed, but I have seen it upgrade automatically and there was at some point some code for doing it automatically. The manual part here only seems to be the ppa configuration. The main point is that the effort required on Ubuntu is less than on NixOS.
Yes, I see that this PPA with an unofficial zoneminder package (from Ubuntu standpoint) does indeed run in its zoneminder.postinst script.
I wasn't aware of this issue until just now, hence the rather late reply. That is correct - so far we have only released a single version in nixpkgs but of course it will come back and bite us. Things can break in unstable - nothing new there and unless we hit security issues, new versions will not be back-ported, so that at least gives us to 19.09 to sort out. What other options (packaged for NixOS) do we have? I personally have very strong reservations about the architectural choices the ZM developers have made, but I am not aware of any real alternative ATM. Declarative camera support is definitely a good idea.

I support for ZM because I needed it and it solves my problem right now (until we need to update of course), but any PR would be very much welcome.
The is already part of the package - we just don't do anything with it and according to the comment in the header: But then of course it does have functionality for dealing with a number of changes. So the short version - someone just has to write (and test) how it behaves when upgraded and ensure this runs. I am realistically not going to work on that right now though.