summaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix34
1 files changed, 29 insertions, 5 deletions
diff --git a/default.nix b/default.nix
index 4352e5c..fac1871 100644
--- a/default.nix
+++ b/default.nix
@@ -7,6 +7,7 @@
}) {},
baseConfig ? import ./config.nix,
+ baseSkipServices ? [],
}: rec {
@@ -14,6 +15,12 @@
redisListenPath = "${config.runDir}/redis";
};
+ skipServices = baseSkipServices ++ (
+ if baseConfig.staticProxyURL == ""
+ then [ "static" ]
+ else []
+ );
+
static = (import ./static) { inherit pkgs; };
srv = (import ./srv) {
@@ -38,20 +45,37 @@
exec ${pkgs.redis}/bin/redis-server ${redisCfg}
'';
- circusCfg = pkgs.writeText "mediocre-blog-circusCfg" ''
- [circus]
- endpoint = tcp://127.0.0.1:0
- pubsub_endpoint = tcp://127.0.0.1:0
-
+ srvCircusCfg = ''
[watcher:srv]
cmd = ${srv.bin}
numprocesses = 1
+ '';
+ redisCircusCfg = ''
[watcher:redis]
cmd = ${redisBin}
numprocesses = 1
'';
+ staticCircusCfg = ''
+ [watcher:static]
+ cmd = ${static.serve}/bin/static-serve
+ numprocesses = 1
+ working_dir = ./static
+ '';
+
+ circusCfg = pkgs.writeText "mediocre-blog-circusCfg" ''
+ [circus]
+ endpoint = tcp://127.0.0.1:0
+ pubsub_endpoint = tcp://127.0.0.1:0
+
+ ${if (!builtins.elem "srv" skipServices) then srvCircusCfg else ""}
+
+ ${if (!builtins.elem "redis" skipServices) then redisCircusCfg else ""}
+
+ ${if (!builtins.elem "static" skipServices) then staticCircusCfg else ""}
+ '';
+
entrypoint = pkgs.writeScript "mediocre-blog-entrypoint" ''
#!/bin/sh
mkdir -p ${config.runDir}