summaryrefslogtreecommitdiffstats
path: root/old/modules/tv/nginx/config.nix
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-07-11 19:44:12 +0200
committertv <tv@shackspace.de>2015-07-11 19:44:12 +0200
commit2bc5c58d85990e483af8fde57ed5f2442351b69c (patch)
tree94cd29e6a98f1ce6228104055d0550e318242290 /old/modules/tv/nginx/config.nix
parentc5fcda1390afaba71133b2ee6ac1ddd0f559ef8c (diff)
move old stuff
Diffstat (limited to 'old/modules/tv/nginx/config.nix')
-rw-r--r--old/modules/tv/nginx/config.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/old/modules/tv/nginx/config.nix b/old/modules/tv/nginx/config.nix
new file mode 100644
index 000000000..4bfd8ad28
--- /dev/null
+++ b/old/modules/tv/nginx/config.nix
@@ -0,0 +1,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;
+ }
+ }
+ '';
+ };
+}