summaryrefslogtreecommitdiff
path: root/srv/default.nix
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-05-05 21:20:22 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-05-05 21:20:22 -0600
commiteed10ce514f28e4acf772f76c92ca05eebec105f (patch)
treed76820d7a3cd23f09f7dd0e6065bb0cef7ba16dc /srv/default.nix
parentcc8b6289ac3f7d1abb648217949beb89827d7374 (diff)
Fix various problems with the srv build
Diffstat (limited to 'srv/default.nix')
-rw-r--r--srv/default.nix40
1 files changed, 22 insertions, 18 deletions
diff --git a/srv/default.nix b/srv/default.nix
index 3037fd7..5510744 100644
--- a/srv/default.nix
+++ b/srv/default.nix
@@ -1,62 +1,66 @@
{
+ bash,
+ go,
buildGoModule,
writeScript,
- writeScriptBin,
+ writeText,
stdenv,
config,
staticBuild,
}: 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
- export MEDIOCRE_BLOG_ML_SMTP_ADDR=${config.mlSMTPAddr}
- export MEDIOCRE_BLOG_ML_SMTP_AUTH='${config.mlSMTPAuth}'
- export MEDIOCRE_BLOG_ML_PUBLIC_URL=${config.mlPublicURL}
+ 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}
+ export MEDIOCRE_BLOG_REDIS_ADDR="${config.redisListenPath}"
# pow
- export MEDIOCRE_BLOG_POW_SECRET=${config.powSecret}
+ export MEDIOCRE_BLOG_POW_SECRET="${config.powSecret}"
# 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}
+ export MEDIOCRE_BLOG_STATIC_URL="${config.staticProxyURL}"
fi
# listening
- export MEDIOCRE_BLOG_LISTEN_PROTO=${config.listenProto}
- export MEDIOCRE_BLOG_LISTEN_ADDR=${config.listenAddr}
+ export MEDIOCRE_BLOG_LISTEN_PROTO="${config.listenProto}"
+ export MEDIOCRE_BLOG_LISTEN_ADDR="${config.listenAddr}"
'';
build = buildGoModule {
pname = "mediocre-blog-srv";
version = "dev";
- src = ./.;
- vendorSha256 = "02szg1lisfjk8pk9pflbyv97ykg9362r4fhd0w0p2a7c81kf9b8y";
+ src = ./src;
+ vendorSha256 = "sha256-/F62WVkI50woo5J0xZOAn0g0WWkDna4wIBeVvbhAGzs=";
# disable tests
checkPhase = '''';
};
bin = writeScript "mediocre-blog-srv-bin" ''
- #!/bin/sh
- mkdir -p "${config.dataDir}"
- source ${env}
+ #!${bash}
+ source ${init}
exec ${build}/bin/mediocre-blog
'';
shell = stdenv.mkDerivation {
name = "mediocre-blog-srv-shell";
+ buildInputs = [ go build ];
shellHook = ''
- source ${env}
+ source ${init}
+ cd src
'';
};
}