diff options
| author | Valentin <valentin@fricklerhandwerk.de> | 2025-12-20 18:22:27 +0100 |
|---|---|---|
| committer | Valentin <valentin@fricklerhandwerk.de> | 2025-12-20 18:22:27 +0100 |
| commit | 8b0a011c7c37d882a2e12ea8de38acaa9e782d38 (patch) | |
| tree | 2daea25b800a0733baa6f45fd71afcadf02a9ffc /www/index.nix | |
| parent | 9a5020deaed97df8ab1307068f34a382b2e24b31 (diff) | |
| parent | 0efd609dd832b11c4e4e20c008edc1cc52dbfbd9 (diff) | |
Merge branch 'nix-html'
HTML werden ab jetzt aus Nix-modulen generiert.
Diffstat (limited to 'www/index.nix')
| -rw-r--r-- | www/index.nix | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/www/index.nix b/www/index.nix new file mode 100644 index 0000000..b1b74dd --- /dev/null +++ b/www/index.nix @@ -0,0 +1,41 @@ +{ self, ... }: +{ + perSystem = + { ... }: + { + websites.${self.domain} = + { config, lib, ... }: + let + inherit (lib) mkOption types; + root = ./html; + files = + with lib.fileset; + toList (difference (fileFilter (file: file.hasExt "html") root) ./html/Kalender); + replacements = { + "@title@" = config.title; + "@stylesheet@" = ''<link rel="stylesheet" type="text/css" href="style.css">''; + "@head@" = '' + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width"> + <meta name="description" content="Informationen zum Stadtteil Heimfeld und seinem Stadtteilbeirat"> + <meta name="keywords" content="Heimfeld, Stadtteil, Hamburg, Stadtteilbeirat, Beirat, Stadtteilfest, Treffpunkthaus"> + <link rel="shortcut icon" type="image/x-icon" href="/img/Kraniche-dreh-klein.gif"> + <script async src="redirects.js"></script> + ''; + }; + replace = file: with lib; replaceStrings (attrNames replacements) (attrValues replacements) file; + in + { + title = "Stadtteilbeirat Heimfeld"; + files = + with lib; + listToAttrs ( + map (path: { + name = lib.path.removePrefix root path; + value = with builtins; toFile (baseNameOf path) (replace (readFile path)); + }) files + ); + }; + }; +} |
