2024-05-22 21:55:06 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
nte,
|
|
|
|
stdenv,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib.attrsets) listToAttrs;
|
|
|
|
inherit (lib.lists) map;
|
|
|
|
inherit (lib.strings) replaceStrings toLower;
|
|
|
|
|
2024-05-25 17:16:01 +02:00
|
|
|
_nte = nte {inherit extraArgs entries templates;};
|
|
|
|
|
2024-05-22 21:55:06 +02:00
|
|
|
extraArgs = {
|
2024-05-25 17:16:01 +02:00
|
|
|
inherit (_nte) getEntry;
|
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}>
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
// listToAttrs (map (n: {
|
|
|
|
name = "h${toString n}";
|
|
|
|
value = text: extraArgs.h n text;
|
|
|
|
}) [ 1 2 3 4 5 6 ]
|
|
|
|
);
|
|
|
|
|
|
|
|
entries = [
|
|
|
|
./index.nix
|
|
|
|
./posts/index.nix
|
|
|
|
./posts/test.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
templates = [
|
|
|
|
./templates/base.nix
|
|
|
|
./templates/post.nix
|
|
|
|
];
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "nte-example";
|
|
|
|
version = "0.1.0";
|
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
buildPhase = /*sh*/''
|
|
|
|
runHook preBuild
|
|
|
|
|
2024-05-25 17:16:01 +02:00
|
|
|
${_nte.buildScript}
|
2024-05-22 21:55:06 +02:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = /*sh*/''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r ./*.css $out
|
|
|
|
cp -r ./posts/*.css $out/posts
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
}
|