Code change:
In the pre-start script for , we symlink the template from the nix store into : However, if changes are made to CUPS via the GUI -- for example, enabling network access -- this symlink is overwritten with a plain file. And it contains a line with paths into the nix store. This effectively freezes some version of the cups binaries into this config file, which is no longer managed by nix. As a result, CUPS can break, e.g. when deletes the referenced store paths. For me, this meant nothing would print, and I started seeing this error in : Manually editing to update the store paths on the line (while the systemd service was stopped) got printing working again for me. I guess we could make the pre-start script do this (with a sed or something), but that seems kind of hacky ... cc commit seems especially relevant here. System: Nix version: Nixpkgs version:
Hm, maybe the right approach is to make just put in the template, and then have it also ensure that points to the correct location in the nix store? Then CUPS can write whatever other changes it wants to its config file, while the nix expression continues to have control over the "final destination" of the path ... ?
I think we want Nix to take priority here because that's what would be expected of declarative configuration and what's already done in other places. So as a quick fix towards this we can force replacement by symlinks. This should also be documented. However, we can leave some option (like currently exists for users) that reverses this and instead makes just insert and other required options. The best of both worlds, of course, would be to split the configuration into generated by Nix and values changed in CUPS on top but I doubt this can be implemented. Thoughts?
For the record, I had the same problem in OctoPrint service. It was solved by writing a small piece of software for updating YAML trees (like in Nix) and making "patch" current configuration with Nix-overridden values. Works perfectly but it would be much more difficult in CUPS ( is some kind of ad-hoc mix between XML and custom plain format).
Yeah, I don't see any directive on the manpage for . :-( Overwriting the config file on every restart of might lead to confusion if folks are trying to use the GUI to get things configured the way they want. In particular, when I made changes in the GUI to enable remote access, it modified some of the stanzas that're currently hard-coded in at So I'm not sure how I would preserve that under this approach. (I tried to just set via , but that wasn't enough -- I don't really understand why ...)
Its man page says: ... but a bit of googling didn't turn up any pre-existing programs designed to read / write that format. (Maybe there is something buried in apache , who knows?)
There is But then you need to write Perl, which might not be an improvement.

Related discussion:
text: for i in *; do [ ! -e "/var/lib/cups/$i" ] && ln -s "${rootdir}/etc/cups/$i" "/var/lib/cups/$i" done <ins> #update path reference [ -L /var/lib/cups/path ] &&  rm /var/lib/cups/path [ ! -e /var/lib/cups/path ] &&  ln -s ${bindir} /var/lib/cups/path </ins> ${optionalString cfg.gutenprint '' if [ -d /var/lib/cups/ppd ]; then ${gutenprint}/bin/cups-genppdupdate -p /var/lib/cups/ppd