1
0
Fork 0

Add mathechor-de

This commit is contained in:
Malte Brandy 2019-02-06 17:13:48 +01:00
parent 31eccd0f1e
commit 10c369ca16
4 changed files with 73 additions and 0 deletions

Binary file not shown.

View file

@ -73,6 +73,10 @@ m-0 = {
server.enable = true;
standalone.enable = true;
git-server.enable = true;
mathechor-de = {
enable = true;
password = config.m-0.private.mathechor-pw;
};
};
home-manager.users."${me.user}" = (import ./home.nix);

View file

@ -8,6 +8,7 @@ in {
./modules/laptop.nix
./modules/git-server.nix
./modules/server
./modules/server/mathechor.de.nix
./modules/standalone
"${builtins.fetchGit "ssh://git@git.darmstadt.ccc.de/cdark.net/nixdark"}/default.nix"
./modules/loginctl-linger.nix

View file

@ -0,0 +1,68 @@
{ config, pkgs, lib, ... }:
with lib;
let
me = config.m-0.private.me;
page = pkgs.stdenv.mkDerivation {
name = "mathechor.de";
src = builtins.fetchGit "git@hera:mathechor.de";
buildInputs = [ pkgs.pandoc pkgs.python3 ];
LC_ALL="en_US.UTF-8";
LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive";
installPhase = ''
mkdir $out
cp -r intern/output $out/intern
cp -r public/output $out/public
'';
};
in
{
options = {
m-0.mathechor-de = {
enable = mkOption {
type = types.bool;
default = false;
};
password = mkOption {
type = types.str;
};
};
};
config = mkIf config.m-0.mathechor-de.enable {
networking.firewall.allowedTCPPorts = [ 80 443 ];
services = {
nginx = {
enable = true;
virtualHosts."mathechor.de" = {
serverAliases = ["www.mathechor.de"];
forceSSL = true;
enableACME = true;
locations = {
"/" = {
root = "${page}/public";
index = "index.html";
extraConfig = "location ~* \.(otf)$ {add_header Access-Control-Allow-Origin *;}";
};
};
};
virtualHosts."intern.mathechor.de" = {
forceSSL = true;
enableACME = true;
basicAuth.mathechor = config.m-0.mathechor-de.password;
locations = {
"/" = {
root = "${page}/intern";
index = "index.html";
};
};
};
};
};
};
}