{ lib, config, ... }: let cfg = config.services.nix-serve; in with lib; { config = mkIf cfg.enable { services = { nix-serve = { secretKeyFile = "/var/cache-priv-key.pem"; }; nginx = { virtualHosts = { # ... existing hosts config etc. ... "binarycache.odie.intranet" = { locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}"; }; }; }; }; }; }