Fix various problems with the srv build
This commit is contained in:
parent
cc8b6289ac
commit
eed10ce514
@ -28,8 +28,6 @@
|
|||||||
staticBuild=static.build;
|
staticBuild=static.build;
|
||||||
};
|
};
|
||||||
|
|
||||||
srvBin = srv.bin;
|
|
||||||
|
|
||||||
redisCfg = pkgs.writeText "mediocre-blog-redisCfg" ''
|
redisCfg = pkgs.writeText "mediocre-blog-redisCfg" ''
|
||||||
port 0
|
port 0
|
||||||
unixsocket ${config.redisListenPath}
|
unixsocket ${config.redisListenPath}
|
||||||
|
@ -1,62 +1,66 @@
|
|||||||
{
|
{
|
||||||
|
bash,
|
||||||
|
go,
|
||||||
buildGoModule,
|
buildGoModule,
|
||||||
writeScript,
|
writeScript,
|
||||||
writeScriptBin,
|
writeText,
|
||||||
stdenv,
|
stdenv,
|
||||||
|
|
||||||
config,
|
config,
|
||||||
staticBuild,
|
staticBuild,
|
||||||
}: rec {
|
}: rec {
|
||||||
|
|
||||||
env = ''
|
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}"
|
||||||
export MEDIOCRE_BLOG_ML_SMTP_AUTH='${config.mlSMTPAuth}'
|
export MEDIOCRE_BLOG_ML_SMTP_AUTH="${config.mlSMTPAuth}"
|
||||||
export MEDIOCRE_BLOG_ML_PUBLIC_URL=${config.mlPublicURL}
|
export MEDIOCRE_BLOG_ML_PUBLIC_URL="${config.mlPublicURL}"
|
||||||
|
|
||||||
# redis
|
# redis
|
||||||
export MEDIOCRE_BLOG_REDIS_PROTO=unix
|
export MEDIOCRE_BLOG_REDIS_PROTO=unix
|
||||||
export MEDIOCRE_BLOG_REDIS_ADDR=${config.redisListenPath}
|
export MEDIOCRE_BLOG_REDIS_ADDR="${config.redisListenPath}"
|
||||||
|
|
||||||
# pow
|
# pow
|
||||||
export MEDIOCRE_BLOG_POW_SECRET=${config.powSecret}
|
export MEDIOCRE_BLOG_POW_SECRET="${config.powSecret}"
|
||||||
|
|
||||||
# static proxy
|
# static proxy
|
||||||
if [ "${config.staticProxyURL}" == "" ]; then
|
if [ "${config.staticProxyURL}" == "" ]; then
|
||||||
export MEDIOCRE_BLOG_STATIC_DIR=${staticBuild}
|
export MEDIOCRE_BLOG_STATIC_DIR="${staticBuild}"
|
||||||
else
|
else
|
||||||
export MEDIOCRE_BLOG_STATIC_URL=${config.staticProxyURL}
|
export MEDIOCRE_BLOG_STATIC_URL="${config.staticProxyURL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# listening
|
# listening
|
||||||
export MEDIOCRE_BLOG_LISTEN_PROTO=${config.listenProto}
|
export MEDIOCRE_BLOG_LISTEN_PROTO="${config.listenProto}"
|
||||||
export MEDIOCRE_BLOG_LISTEN_ADDR=${config.listenAddr}
|
export MEDIOCRE_BLOG_LISTEN_ADDR="${config.listenAddr}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
build = buildGoModule {
|
build = buildGoModule {
|
||||||
pname = "mediocre-blog-srv";
|
pname = "mediocre-blog-srv";
|
||||||
version = "dev";
|
version = "dev";
|
||||||
src = ./.;
|
src = ./src;
|
||||||
vendorSha256 = "02szg1lisfjk8pk9pflbyv97ykg9362r4fhd0w0p2a7c81kf9b8y";
|
vendorSha256 = "sha256-/F62WVkI50woo5J0xZOAn0g0WWkDna4wIBeVvbhAGzs=";
|
||||||
|
|
||||||
# disable tests
|
# disable tests
|
||||||
checkPhase = '''';
|
checkPhase = '''';
|
||||||
};
|
};
|
||||||
|
|
||||||
bin = writeScript "mediocre-blog-srv-bin" ''
|
bin = writeScript "mediocre-blog-srv-bin" ''
|
||||||
#!/bin/sh
|
#!${bash}
|
||||||
mkdir -p "${config.dataDir}"
|
source ${init}
|
||||||
source ${env}
|
|
||||||
exec ${build}/bin/mediocre-blog
|
exec ${build}/bin/mediocre-blog
|
||||||
'';
|
'';
|
||||||
|
|
||||||
shell = stdenv.mkDerivation {
|
shell = stdenv.mkDerivation {
|
||||||
name = "mediocre-blog-srv-shell";
|
name = "mediocre-blog-srv-shell";
|
||||||
|
buildInputs = [ go build ];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
source ${env}
|
source ${init}
|
||||||
|
cd src
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user