Cleanup and fix dev entrypoint target

This commit is contained in:
Brian Picciano 2022-05-08 16:48:03 -06:00
parent a759fc28f7
commit a6269d1fe0
3 changed files with 4 additions and 27 deletions

View File

@ -8,7 +8,4 @@
mlPublicURL = "http://localhost:4000"; mlPublicURL = "http://localhost:4000";
listenProto = "tcp"; listenProto = "tcp";
listenAddr = ":4000"; listenAddr = ":4000";
# If empty then a derived static directory is used
staticProxyURL = "http://127.0.0.1:4002";
} }

View File

@ -7,7 +7,7 @@
}) {}, }) {},
baseConfig ? import ./config.nix, baseConfig ? import ./config.nix,
baseSkipServices ? [], skipServices ? [],
}: rec { }: rec {
@ -17,12 +17,6 @@
redisListenPath = "${config.runDir}/redis"; redisListenPath = "${config.runDir}/redis";
}; };
skipServices = baseSkipServices ++ (
if baseConfig.staticProxyURL == ""
then [ "static" ]
else []
);
static = (import ./static) { inherit pkgs; }; static = (import ./static) { inherit pkgs; };
srv = pkgs.callPackage (import ./srv) { srv = pkgs.callPackage (import ./srv) {
@ -59,13 +53,6 @@
numprocesses = 1 numprocesses = 1
''; '';
staticCircusCfg = ''
[watcher:static]
cmd = ${static.serve}/bin/static-serve
numprocesses = 1
working_dir = ./static
'';
circusCfg = pkgs.writeText "mediocre-blog-circusCfg" '' circusCfg = pkgs.writeText "mediocre-blog-circusCfg" ''
[circus] [circus]
endpoint = tcp://127.0.0.1:0 endpoint = tcp://127.0.0.1:0
@ -74,8 +61,6 @@
${if (!builtins.elem "srv" skipServices) then srvCircusCfg else ""} ${if (!builtins.elem "srv" skipServices) then srvCircusCfg else ""}
${if (!builtins.elem "redis" skipServices) then redisCircusCfg else ""} ${if (!builtins.elem "redis" skipServices) then redisCircusCfg else ""}
${if (!builtins.elem "static" skipServices) then staticCircusCfg else ""}
''; '';
entrypoint = pkgs.writeScript "mediocre-blog-entrypoint" '' entrypoint = pkgs.writeScript "mediocre-blog-entrypoint" ''

View File

@ -13,7 +13,6 @@
init = writeText "mediocre-blog-srv-init" '' init = writeText "mediocre-blog-srv-init" ''
export MEDIOCRE_BLOG_DATA_DIR="${config.dataDir}" export MEDIOCRE_BLOG_DATA_DIR="${config.dataDir}"
mkdir -p "${config.dataDir}"
# mailing list # mailing list
export MEDIOCRE_BLOG_ML_SMTP_ADDR="${config.mlSMTPAddr}" export MEDIOCRE_BLOG_ML_SMTP_ADDR="${config.mlSMTPAddr}"
@ -28,11 +27,7 @@
export MEDIOCRE_BLOG_POW_SECRET="${config.powSecret}" export MEDIOCRE_BLOG_POW_SECRET="${config.powSecret}"
# static proxy # static proxy
if [ "${config.staticProxyURL}" == "" ]; then
export MEDIOCRE_BLOG_STATIC_DIR="${staticBuild}" export MEDIOCRE_BLOG_STATIC_DIR="${staticBuild}"
else
export MEDIOCRE_BLOG_STATIC_URL="${config.staticProxyURL}"
fi
# listening # listening
export MEDIOCRE_BLOG_LISTEN_PROTO="${config.listenProto}" export MEDIOCRE_BLOG_LISTEN_PROTO="${config.listenProto}"
@ -43,14 +38,14 @@
pname = "mediocre-blog-srv"; pname = "mediocre-blog-srv";
version = "dev"; version = "dev";
src = ./src; src = ./src;
vendorSha256 = "sha256-/F62WVkI50woo5J0xZOAn0g0WWkDna4wIBeVvbhAGzs="; vendorSha256 = "sha256-MdjPrNSAAiqkAnJRIhMFTVQDKIPuDCHqRQFEtnoe1Cc=";
# disable tests # disable tests
checkPhase = ''''; checkPhase = '''';
}; };
bin = writeScript "mediocre-blog-srv-bin" '' bin = writeScript "mediocre-blog-srv-bin" ''
#!${bash} #!${bash}/bin/bash
source ${init} source ${init}
exec ${build}/bin/mediocre-blog exec ${build}/bin/mediocre-blog
''; '';