blob: 3fb6293944c7abe15f9460d930e202a5a029fe4d (
plain)
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
|
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
let
sec = toString <secrets>;
hostname = config.krebs.build.host.name;
user = config.services.nginx.user;
group = config.services.nginx.group;
base-dir = "/var/www/blog.euer";
in {
# Prepare Blog directory
systemd.services.prepare-euer-blog = {
wantedBy = [ "local-fs.target" ];
before = [ "nginx.service" ];
serviceConfig = {
# do nothing if the base dir already exists
ExecStart = pkgs.writeScript "prepare-euer-blog-service" ''
#!/bin/sh
if ! test -d "${base-dir}" ;then
mkdir -p "${base-dir}"
chown ${user}:${group} "${base-dir}"
chmod 700 "${base-dir}"
fi
'';
Type = "oneshot";
RemainAfterExit = "yes";
TimeoutSec = "0";
};
};
services.nginx = {
enable = mkDefault true;
virtualHosts = {
"euer.krebsco.de" = {
#serverAliases = [ "blog.euer.krebsco.de" "blog.${hostname}" ];
enableSSL = true;
enableACME = true;
forceSSL = true;
root = base-dir;
};
};
};
}
|