nte/example/default.nix

45 lines
900 B
Nix
Raw Normal View History

2024-05-22 21:55:06 +02:00
{
lib,
2024-09-12 23:09:29 +02:00
mkNteDerivation,
2024-05-22 21:55:06 +02:00
...
}: let
inherit (lib.attrsets) listToAttrs;
inherit (lib.lists) map;
inherit (lib.strings) replaceStrings toLower;
2024-09-12 23:09:29 +02:00
extraArgs' = {
2024-05-22 21:55:06 +02:00
h = n: content: let
id = replaceStrings [" " ";"] ["-" "-"] (toLower content);
in /*html*/''
<h${toString n} id="${id}"><a href="#${id}">#</a> ${content}</h${toString n}>
'';
2024-09-12 23:09:29 +02:00
};
in mkNteDerivation {
name = "nte-example";
version = "0.1.0";
src = ./.;
extraArgs = extraArgs'
// listToAttrs (map (n: {
name = "h${toString n}";
value = text: extraArgs'.h n text;
}) [ 1 2 3 4 5 6 ]
);
2024-05-22 21:55:06 +02:00
entries = [
./index.nix
./posts/index.nix
./posts/test.nix
];
templates = [
./templates/base.nix
./templates/post.nix
];
2024-09-12 23:09:29 +02:00
extraFiles = [
{ source = "./*.css"; destination = "/"; }
{ source = "./posts/*.css"; destination = "/posts"; }
];
}