2022-11-27 20:25:25 +00:00
|
|
|
{
|
|
|
|
inputs.pkgsSrc.url = "nixpkgs/nixos-21.05";
|
|
|
|
inputs.utils.url = "github:numtide/flake-utils";
|
|
|
|
|
|
|
|
outputs = {
|
|
|
|
|
|
|
|
self, pkgsSrc, utils
|
|
|
|
|
|
|
|
}: utils.lib.eachSystem utils.lib.allSystems (system: let
|
|
|
|
|
|
|
|
pkgs = import pkgsSrc { inherit system; };
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
|
|
|
defaultPackage = pkgs.buildGoModule {
|
|
|
|
pname = "mediocre-blog";
|
|
|
|
version = "dev";
|
|
|
|
src = ./src;
|
|
|
|
|
2023-01-21 17:36:28 +00:00
|
|
|
vendorSha256 = "sha256-FvuRkMsheUqYVDu9Bn+QIX/2n/g1vl3Qp92r84lUJOg=";
|
2022-11-27 20:25:25 +00:00
|
|
|
|
|
|
|
subPackages = [ "cmd/mediocre-blog" ];
|
|
|
|
|
|
|
|
# disable tests
|
|
|
|
checkPhase = '''';
|
|
|
|
};
|
|
|
|
|
|
|
|
devShell = pkgs.mkShell {
|
2023-01-20 13:50:36 +00:00
|
|
|
buildInputs = [ pkgs.go pkgs.sqlite pkgs.amfora ];
|
2022-11-27 20:25:25 +00:00
|
|
|
shellHook = ''
|
|
|
|
|
|
|
|
export MEDIOCRE_BLOG_DATA_DIR="/tmp/mediocre-blog/data"
|
|
|
|
|
|
|
|
# mailing list
|
|
|
|
export MEDIOCRE_BLOG_ML_SMTP_ADDR=""
|
|
|
|
export MEDIOCRE_BLOG_ML_SMTP_AUTH=""
|
|
|
|
export MEDIOCRE_BLOG_ML_PUBLIC_URL="http://localhost:4000"
|
|
|
|
|
|
|
|
# pow
|
|
|
|
export MEDIOCRE_BLOG_POW_SECRET="ssshhh"
|
|
|
|
|
|
|
|
# http
|
|
|
|
export MEDIOCRE_BLOG_HTTP_PUBLIC_URL="$MEDIOCRE_BLOG_ML_PUBLIC_URL"
|
|
|
|
export MEDIOCRE_BLOG_HTTP_LISTEN_PROTO="tcp"
|
|
|
|
export MEDIOCRE_BLOG_HTTP_LISTEN_ADDR=":4000"
|
2023-01-23 15:02:35 +00:00
|
|
|
export MEDIOCRE_BLOG_HTTP_GEMINI_GATEWAY_URL="https://nightfall.city/x/"
|
2022-11-27 20:25:25 +00:00
|
|
|
|
|
|
|
# http auth
|
|
|
|
# (password is "bar". This should definitely be changed for prod.)
|
|
|
|
export MEDIOCRE_BLOG_HTTP_AUTH_USERS='{"foo":"$2a$13$0JdWlUfHc.3XimEMpEu1cuu6RodhUvzD9l7iiAqa4YkM3mcFV5Pxi"}'
|
|
|
|
export MEDIOCRE_BLOG_HTTP_AUTH_RATELIMIT="1s"
|
|
|
|
|
2023-01-20 13:50:36 +00:00
|
|
|
# gmi
|
|
|
|
export MEDIOCRE_BLOG_GEMINI_PUBLIC_URL="gemini://localhost:2096"
|
|
|
|
export MEDIOCRE_BLOG_GEMINI_LISTEN_ADDR=":2065"
|
|
|
|
export MEDIOCRE_BLOG_GEMINI_CERTIFICATES_PATH="$MEDIOCRE_BLOG_DATA_DIR/gmi/certs"
|
|
|
|
|
2022-11-27 20:25:25 +00:00
|
|
|
cd src
|
|
|
|
|
|
|
|
echo 'Loading test data...'
|
|
|
|
(cd cmd/load-test-data && go run main.go)
|
|
|
|
|
|
|
|
echo -e "\n\nTest data has been loaded into $MEDIOCRE_BLOG_DATA_DIR\n"
|
2023-01-20 13:50:36 +00:00
|
|
|
echo -e "You can do 'go run ./cmd/mediocre-blog/main.go' to start a dev instance on http://localhost:4000\n"
|
|
|
|
echo -e "You can then do 'amfora gemini://localhost:2065' to test the gemini server\n"
|
2022-11-27 20:25:25 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|