2022-05-06 02:57:17 +00:00
|
|
|
{
|
|
|
|
buildGoModule,
|
|
|
|
writeScript,
|
|
|
|
writeScriptBin,
|
|
|
|
stdenv,
|
|
|
|
|
|
|
|
config,
|
|
|
|
staticBuild,
|
|
|
|
}: rec {
|
|
|
|
|
|
|
|
env = ''
|
|
|
|
|
|
|
|
export MEDIOCRE_BLOG_DATA_DIR=${config.dataDir}
|
|
|
|
|
|
|
|
# mailing list
|
|
|
|
export MEDIOCRE_BLOG_ML_SMTP_ADDR=${config.mlSMTPAddr}
|
|
|
|
export MEDIOCRE_BLOG_ML_SMTP_AUTH='${config.mlSMTPAuth}'
|
|
|
|
export MEDIOCRE_BLOG_ML_PUBLIC_URL=${config.mlPublicURL}
|
|
|
|
|
|
|
|
# redis
|
|
|
|
export MEDIOCRE_BLOG_REDIS_PROTO=unix
|
|
|
|
export MEDIOCRE_BLOG_REDIS_ADDR=${config.redisListenPath}
|
|
|
|
|
|
|
|
# pow
|
|
|
|
export MEDIOCRE_BLOG_POW_SECRET=${config.powSecret}
|
|
|
|
|
|
|
|
# static proxy
|
|
|
|
if [ "${config.staticProxyURL}" == "" ]; then
|
|
|
|
export MEDIOCRE_BLOG_STATIC_DIR=${staticBuild}
|
|
|
|
else
|
|
|
|
export MEDIOCRE_BLOG_STATIC_URL=${config.staticProxyURL}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# listening
|
|
|
|
export MEDIOCRE_BLOG_LISTEN_PROTO=${config.listenProto}
|
|
|
|
export MEDIOCRE_BLOG_LISTEN_ADDR=${config.listenAddr}
|
|
|
|
'';
|
|
|
|
|
|
|
|
build = buildGoModule {
|
2021-08-08 13:57:45 +00:00
|
|
|
pname = "mediocre-blog-srv";
|
|
|
|
version = "dev";
|
|
|
|
src = ./.;
|
2021-09-02 23:02:20 +00:00
|
|
|
vendorSha256 = "02szg1lisfjk8pk9pflbyv97ykg9362r4fhd0w0p2a7c81kf9b8y";
|
2021-08-28 00:03:51 +00:00
|
|
|
|
|
|
|
# disable tests
|
|
|
|
checkPhase = '''';
|
2021-08-08 13:57:45 +00:00
|
|
|
};
|
2021-07-31 22:45:49 +00:00
|
|
|
|
2022-05-06 02:57:17 +00:00
|
|
|
bin = writeScript "mediocre-blog-srv-bin" ''
|
2021-08-08 13:57:45 +00:00
|
|
|
#!/bin/sh
|
2021-08-27 03:28:27 +00:00
|
|
|
mkdir -p "${config.dataDir}"
|
2022-05-06 02:57:17 +00:00
|
|
|
source ${env}
|
|
|
|
exec ${build}/bin/mediocre-blog
|
2021-08-08 15:07:51 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-06 02:57:17 +00:00
|
|
|
shell = stdenv.mkDerivation {
|
2021-08-08 13:57:45 +00:00
|
|
|
name = "mediocre-blog-srv-shell";
|
2022-05-06 02:57:17 +00:00
|
|
|
shellHook = ''
|
|
|
|
source ${env}
|
|
|
|
'';
|
2021-08-08 13:57:45 +00:00
|
|
|
};
|
|
|
|
}
|