Sometimes, it’s useful to move some configuration from configuration.nix to separate files (e.g. webserver configuration).
Is there a simple way to import a file as a string?
Like e.g.: lighttpd.configText = read(lighttpd.conf)
Currently, it’s e.g. possible by using: lighttpd.configText = 'include "lighttpd.conf"';
But then, nixos-rebuild does not rebuild the configuration when something in lighttpd.conf is changed.
Can I force nixos-rebuilt to rebuild the lighttpd-config in this case?
Or simply lighttpd.configFile = ./lighttpd.conf when the module has such an option (which is not the case here). The above option loads the file content as a string. This one uses the file directly by copying it to the store.
You should be aware that loading the whole config like this overrides “the contents automatically generated by NixOS”. lighttpd.configText