1
0
Fork 0

Ergänze blog

This commit is contained in:
Malte Brandy 2019-02-25 03:05:02 +01:00
parent a6652f7dcd
commit 99c9edc71d
3 changed files with 55 additions and 0 deletions

View file

@ -43,6 +43,7 @@ containers.web = {
firewall.allowedTCPPorts = [ 80 443 ];
};
m-0 = {
blog.enable = true;
mathechor-de = {
enable = true;
password = config.m-0.private.mathechor-pw;

View file

@ -12,6 +12,7 @@ in {
./modules/git.nix
./modules/mathechor.de.nix
./modules/server
./modules/blog.nix
./modules/standalone
"${(builtins.fetchGit "ssh://git@git.darmstadt.ccc.de/cdark.net/nixdark")}"
"${(builtins.fetchGit "ssh://git@hera/nixos-mailserver")}"

53
system/modules/blog.nix Normal file
View file

@ -0,0 +1,53 @@
{ config, pkgs, lib, ... }:
with lib;
let
page = pkgs.stdenv.mkDerivation {
name = "blog.maralorn.de";
src = builtins.fetchGit "git@hera:blog";
buildInputs = [ (pkgs.python3.withPackages (ps: [ps.pelican ps.markdown])) ];
LC_ALL="en_US.UTF-8";
LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive";
buildPhase = ''
make html
'';
installPhase = ''
mkdir $out
cp -r output/* $out
'';
};
in
{
options = {
m-0.blog = {
enable = mkOption {
type = types.bool;
default = false;
};
};
};
config = mkIf config.m-0.blog.enable {
networking.firewall.allowedTCPPorts = [ 80 443 ];
services = {
nginx = {
enable = true;
virtualHosts."blog.maralorn.de" = {
forceSSL = true;
enableACME = true;
locations = {
"/" = {
root = "${page}";
index = "index.html";
};
};
};
};
};
};
}