aboutsummaryrefslogtreecommitdiff
path: root/www/index.nix
blob: e2e6528d81320e0b29c3ca517c0877ac188d5059 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ self, ... }:
{
  perSystem =
    { ... }:
    {
      websites.${self.domain} =
        { config, lib, ... }:
        let
          inherit (lib) mkOption types;
          replacements = {
            "@title@" = config.title;
            "@stylesheet@" = ''<link rel="stylesheet" type="text/css" href="style.css">'';
          };
          replace = file: with lib; replaceStrings (attrNames replacements) (attrValues replacements) file;
        in
        {
          files =
            with lib;
            listToAttrs (
              map
                (path: rec {
                  name = baseNameOf path;
                  value = with builtins; toFile "index.html" (replace (readFile path));
                })
                [
                  ./html/index.html
                  ./html/vergangene-termine.html
                  ./html/impressum.html
                  ./html/datenschutz.html
                ]
            );
        };
    };
}