nixos-config/machines/renge/services/sbruder.xyz/default.nix
Simon Bruder f945341668
Relicense
This applies the REUSE specification to the repository, so the licensing
information can be tracked for every file individually.
2024-01-13 14:35:31 +01:00

65 lines
1.3 KiB
Nix

# SPDX-FileCopyrightText: 2021-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, pkgs, ... }:
let
goneVhost = {
locations."~ .*".return = "303 'https://sbruder.xyz/#history'";
};
in
{
imports = [
./blocks.nix
];
services.nginx.virtualHosts."sbruder.xyz" = {
root = pkgs.stdenvNoCC.mkDerivation {
name = "sbruder.xyz";
src = ./.;
nativeBuildInputs = with pkgs; [ pandoc ];
buildPhase = ''
runHook preBuild
pandoc \
-s \
--metadata-file metadata.yaml \
-f commonmark_x \
-t html5 \
-o index.html \
index.md
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -D index.html $out/index.html
runHook postInstall
'';
};
extraConfig = ''
allow ${config.sbruder.wireguard.home.subnet};
deny all;
'';
locations = {
"/imprint/".alias = "${pkgs.sbruder.imprint}/";
"/transparency/" = {
alias = "/var/www/transparency/";
extraConfig = ''
autoindex on;
charset utf-8;
'';
};
};
};
services.nginx.virtualHosts."nitter.sbruder.xyz" = goneVhost;
services.nginx.virtualHosts."libreddit.sbruder.xyz" = goneVhost;
}