nixos-config/modules/nix-serve/default.nix
Erwin Boskma 4cd0f83ce8
Some checks failed
/ check (push) Failing after 2m46s
Run nixfmt
2024-02-05 11:46:52 +01:00

35 lines
817 B
Nix

{ config, lib, ... }:
with lib;
let
cfg = config.eboskma.nix-serve;
in
{
options.eboskma.nix-serve = {
enable = mkEnableOption "nix-serve";
};
config = mkIf cfg.enable {
services.nix-serve = {
enable = true;
secretKeyFile = "/var/cache-priv-key.pem";
bindAddress = "127.0.0.1";
};
systemd.tmpfiles.rules = [
"C /run/cache-priv-key.pem 400 nix-serve root - ${config.services.nix-serve.secretKeyFile}"
];
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"loki.datarift.nl" = {
serverAliases = [ "loki" ];
locations."/".proxyPass = "http://localhost:${toString config.services.nix-serve.port}";
};
};
};
networking.firewall.allowedTCPPorts = [ 80 ];
};
}