summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/cachecache.nix
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-12-16 20:28:28 +0100
committerjeschli <jeschli@gmail.com>2018-12-16 20:28:28 +0100
commit8605ac91ae3a3859ab906a5fa2e9b0e3dfcd6e1e (patch)
tree77618847347d2526897e94da744ab57588947567 /krebs/3modules/cachecache.nix
parent5030b74cc5c578bb82619a24592504a6008f1a10 (diff)
parent8705b4dbc8e8cf0c4e09c114daad3f96026520ab (diff)
Merge branch 'master' of prism.r:stockholm
Diffstat (limited to 'krebs/3modules/cachecache.nix')
-rw-r--r--krebs/3modules/cachecache.nix20
1 files changed, 10 insertions, 10 deletions
diff --git a/krebs/3modules/cachecache.nix b/krebs/3modules/cachecache.nix
index 989320480..2c2d07ff5 100644
--- a/krebs/3modules/cachecache.nix
+++ b/krebs/3modules/cachecache.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ pkgs, config, lib, ... }:
# fork of https://gist.github.com/rycee/f495fc6cc4130f155e8b670609a1e57b
@@ -59,15 +59,6 @@ in
'';
};
- # webRoot = mkOption {
- # type = types.str;
- # default = "/";
- # description = ''
- # Directory on virtual host that serves the cache. Must end in
- # <literal>/</literal>.
- # '';
- # };
-
resolver = mkOption {
type = types.str;
description = "Address of DNS resolver.";
@@ -82,6 +73,13 @@ in
Where nginx should store cached data.
'';
};
+ indexFile = mkOption {
+ type = types.path;
+ default = pkgs.writeText "myindex" "<html>hello world</html>";
+ description = ''
+ Path to index.html file.
+ '';
+ };
maxSize = mkOption {
type = types.str;
@@ -98,6 +96,7 @@ in
systemd.services.nginx.preStart = ''
mkdir -p ${cfg.cacheDir} /srv/www/nix-cache-cache
chmod 700 ${cfg.cacheDir} /srv/www/nix-cache-cache
+ ln -fs ${cfg.indexFile} /srv/www/nix-cache-cache/index.html
chown ${nginxCfg.user}:${nginxCfg.group} \
${cfg.cacheDir} /srv/www/nix-cache-cache
'';
@@ -143,6 +142,7 @@ in
locations."/" =
{
root = "/srv/www/nix-cache-cache";
+ index = "index.html";
extraConfig = ''
expires max;
add_header Cache-Control $nix_cache_cache_header always;