37 lines
948 B
Nix
37 lines
948 B
Nix
{
|
|
pkgs,
|
|
inputs,
|
|
lib,
|
|
...
|
|
}: let
|
|
theme = inputs.zola-theme;
|
|
themeName = (builtins.fromTOML (builtins.readFile "${theme}/theme.toml")).name;
|
|
package = pkgs.stdenv.mkDerivation {
|
|
name = "static-website";
|
|
src = with lib.fileset;
|
|
toSource {
|
|
root = ./.;
|
|
fileset = difference (gitTracked ./.) (unions [./default.nix ./.envrc]);
|
|
};
|
|
nativeBuildInputs = [pkgs.zola];
|
|
configurePhase = ''
|
|
mkdir themes
|
|
ln -s ${theme} themes/${themeName}
|
|
'';
|
|
buildPhase = "zola build";
|
|
installPhase = "cp -r public $out";
|
|
};
|
|
in {
|
|
services.nginx.virtualHosts."moritz.place".root = "${package}";
|
|
services.nginx.virtualHosts."moritz.place".locations."/" = {
|
|
index = "index.html";
|
|
tryFiles = ''"''${uri}.html" $uri $uri/ =404'';
|
|
};
|
|
services.nginx.virtualHosts."moritz.place".extraConfig = ''
|
|
error_page 404 /404.html;
|
|
|
|
location = /404.html {
|
|
internal;
|
|
}
|
|
'';
|
|
}
|