In configuration.nix can I read a value from a file?

Not sure about arbitrary directories but you can read a file in the current directory (which is /etc/nixos) using builtins.readFile. For instance here is how I add custom TLS certificates:

security.pki.certificates = [ (builtins.readFile ./ca-bundle.crt) ];
5 Likes