os/hosts/frikandel/website.nix

47 lines
931 B
Nix

{
pkgs,
lib,
...
}: let
bbeu = pkgs.stdenv.mkDerivation {
name = "benjaminbaedorf.eu";
src = pkgs.fetchgit {
url = "https://git.pub.solar/b12f/benjaminbaedorf.eu.git";
sparseCheckout = [
"fonts"
"cows.jpg"
"fonts.css"
"index.html"
"public-pgp-benjamin-baedorf.asc"
];
hash = "sha256-c5nU9zqrHgD+dCXdXXcS9xJIaGueyXQpuwSqv0aSLM0=";
};
installPhase = ''
mkdir -p $out
cp -r * $out/
'';
};
in {
services.caddy.virtualHosts = {
"benjaminbaedorf.eu" = {
extraConfig = ''
redir https://b12f.io{uri} temporary
'';
};
"b12f.io" = {
extraConfig = ''
handle {
root * ${bbeu}
try_files {path}.html {path}
file_server
}
handle_errors {
respond "{http.error.status_code} {http.error.status_text}"
}
'';
};
};
}