2018-01-01 23:20:17 +01:00
|
|
|
{ pkgs, config, ... }:
|
|
|
|
|
2018-01-02 00:55:23 +01:00
|
|
|
with pkgs; let blogSource = fetchgit {
|
|
|
|
url = "https://git.tazj.in/tazjin/tazblog.git";
|
|
|
|
sha256 = "0m745vb8k6slzdsld63rbfg583k70q3g6i5lz576sccalkg0r2l2";
|
|
|
|
rev = "aeeb11f1b76729115c4db98f419cbcda1a0f7660";
|
|
|
|
};
|
|
|
|
tazblog = import ./tazblog { inherit blogSource; };
|
|
|
|
blog = tazblog.tazblog;
|
|
|
|
blogConfig = {
|
|
|
|
enableACME = true;
|
2018-01-02 12:08:23 +01:00
|
|
|
forceSSL = true;
|
2018-01-02 00:55:23 +01:00
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:8000";
|
2018-01-01 23:20:17 +01:00
|
|
|
};
|
2018-01-02 00:55:23 +01:00
|
|
|
};
|
2018-01-01 23:20:17 +01:00
|
|
|
in {
|
|
|
|
# Ensure that blog software is installed
|
|
|
|
environment.systemPackages = [
|
|
|
|
blog
|
|
|
|
blogSource
|
|
|
|
];
|
|
|
|
|
|
|
|
# Set up database unit
|
|
|
|
systemd.services.tazblog-db = {
|
|
|
|
description = "Database engine for Tazblog";
|
|
|
|
script = "${blog}/bin/tazblog-db";
|
|
|
|
serviceConfig.restart = "always";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Set up blog unit
|
|
|
|
systemd.services.tazblog = {
|
|
|
|
description = "Tazjin's blog engine";
|
|
|
|
script = "${blog}/bin/tazblog --resourceDir ${blogSource}/static";
|
|
|
|
serviceConfig.restart = "always";
|
|
|
|
requires = [ "tazblog-db.service" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
2018-01-02 00:55:23 +01:00
|
|
|
|
2018-01-02 12:08:23 +01:00
|
|
|
# Set up Gogs
|
|
|
|
services.gogs = {
|
|
|
|
enable = true;
|
|
|
|
appName = "Gogs: tazjin's private code";
|
|
|
|
cookieSecure = true;
|
|
|
|
domain = "git.tazj.in";
|
|
|
|
rootUrl = "https://git.tazj.in/";
|
|
|
|
};
|
|
|
|
|
2018-01-02 00:55:23 +01:00
|
|
|
# Set up reverse proxy
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
|
2018-01-02 12:08:23 +01:00
|
|
|
# Blog!
|
2018-01-02 00:55:23 +01:00
|
|
|
virtualHosts."tazj.in" = blogConfig;
|
|
|
|
virtualHosts."www.tazj.in" = blogConfig;
|
2018-01-02 12:08:23 +01:00
|
|
|
|
|
|
|
# Git!
|
|
|
|
virtualHosts."git.tazj.in" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:3000";
|
|
|
|
};
|
|
|
|
};
|
2018-01-03 14:31:38 +01:00
|
|
|
|
|
|
|
# oslo.pub redirect
|
|
|
|
virtualHosts."oslo.pub" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
extraConfig = "return 302 https://www.google.com/maps/d/viewer?mid=1pJIYY9cuEdt9DuMTbb4etBVq7hs;";
|
|
|
|
};
|
2018-01-02 00:55:23 +01:00
|
|
|
};
|
2018-01-01 23:20:17 +01:00
|
|
|
}
|