blob: 4bfd8ad28a5c1bbbe92561ac8c3a608af75eeef0 (
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
44
45
46
47
48
49
|
{ cfg, config, lib, pkgs, ... }:
let
inherit (lib) concatStrings replaceChars;
indent = replaceChars ["\n"] ["\n "];
to-location = { name, value }: ''
location ${name} {
${indent value}
}
'';
in
{
services.nginx =
let
name = config.tv.retiolum.name;
qname = "${name}.retiolum";
in
assert config.tv.retiolum.enable;
{
enable = true;
httpConfig = ''
include ${pkgs.nginx}/conf/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80 default_server;
server_name _;
location / {
return 404;
}
}
server {
listen 80;
server_name ${name} ${qname};
${indent (concatStrings (map to-location cfg.retiolum-locations))}
location / {
return 404;
}
}
'';
};
}
|