blob: 8544475002df5aee7569565b435b07adc0cd7559 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
{...}: let
domains = import ./hosts.nix {};
mkVirtHost = {
domain,
root,
url,
}: {
name = "${domain}";
value = {
forceSSL = true;
enableACME = true;
root = "${root}";
};
};
mkNixSyncRepository = {
domain,
root,
url,
}: {
name = "${domain}";
value = {
path = "${root}";
uri = "${url}";
};
};
virtHosts = builtins.listToAttrs (builtins.map mkVirtHost domains);
nixSyncRepositories = builtins.listToAttrs (builtins.map mkNixSyncRepository domains);
in {
security.acme = {
acceptTerms = true;
defaults = {
email = "admin@vhack.eu";
webroot = "/var/lib/acme/acme-challenge";
};
};
networking.firewall = {
allowedTCPPorts = [80 443];
};
services.nginx = {
enable = true;
virtualHosts = virtHosts;
};
services.nix-sync = {
enable = true;
repositories = nixSyncRepositories;
};
}
|