]> Git — Sourcephile - sourcephile-nix.git/blob - hosts/mermet/nginx.nix
mermet: unbound: provide a DNS cache for iodine users
[sourcephile-nix.git] / hosts / mermet / nginx.nix
1 { pkgs, lib, config, ... }:
2 let
3 inherit (config) networking;
4 inherit (config.services) nginx;
5 in
6 {
7 imports = [
8 ../../nixos/profiles/services/nginx.nix
9 nginx/autogeree.net.nix
10 nginx/sourcephile.fr.nix
11 ];
12 users.groups."acme".members = [nginx.user];
13 users.groups."keys".members = [nginx.user];
14 networking.nftables.ruleset = ''
15 add rule inet filter net2fw tcp dport 80 counter accept comment "HTTP"
16 add rule inet filter net2fw tcp dport 443 counter accept comment "HTTPS"
17 '';
18 services.nginx = {
19 enable = true;
20 package = pkgs.nginx.override {
21 modules = with pkgs.nginxModules; [
22 fancyindex
23 ];
24 };
25 resolver = {
26 addresses = [ "127.0.0.1:53" ];
27 valid = "";
28 };
29 virtualHosts."_" = {
30 forceSSL = true;
31 useACMEHost = networking.domain;
32 };
33 };
34 fileSystems."/var/lib/nginx" = {
35 device = "rpool/var/www";
36 fsType = "zfs";
37 };
38 services.sanoid.datasets."rpool/var/www" = {
39 use_template = [ "snap" ];
40 daily = 7;
41 };
42 }