-
Notifications
You must be signed in to change notification settings - Fork 14
/
default.nix
46 lines (41 loc) · 1.08 KB
/
default.nix
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
35
36
37
38
39
40
41
42
43
44
45
46
{
jetbrains-mono,
lib,
mkNteDerivation,
webringMembers,
writeText,
...
}: let
inherit (lib.attrsets) listToAttrs;
inherit (lib.lists) map;
inherit (lib.strings) replaceStrings toLower;
h = n: content: let
id = replaceStrings [" " ";" "?"] ["-" "-" ""] (toLower content);
in /*html*/''
<h${toString n} id="${id}"><a href="#${id}">#</a> ${content}</h${toString n}>
'';
hs = listToAttrs (map (n: {
name = "h${toString n}";
value = text: h n text;
}) [ 1 2 3 4 5 6 ]);
in mkNteDerivation {
name = "nix-webring-site";
version = "0.1.0";
src = ./.;
extraArgs = hs // {
inherit h webringMembers;
};
entries = [
./index.nix
];
extraFiles = [
{ source = "./index.css"; destination = "/"; }
{ source = "./nix-webring.svg"; destination = "/"; }
{ source = "./nix.svg"; destination = "/"; }
{ source = "${jetbrains-mono}/share/fonts/truetype/JetBrainsMono-Regular.ttf"; destination = "/"; }
{
source = writeText "webring.json" (builtins.toJSON webringMembers);
destination = "/webring.json";
}
];
}