update example to work with latest changes

This commit is contained in:
jacekpoz 2024-05-25 17:16:01 +02:00
parent 9fc59b7048
commit f6bc03bea7
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
7 changed files with 10 additions and 11 deletions

View file

@ -8,7 +8,10 @@
inherit (lib.lists) map;
inherit (lib.strings) replaceStrings toLower;
_nte = nte {inherit extraArgs entries templates;};
extraArgs = {
inherit (_nte) getEntry;
h = n: content: let
id = replaceStrings [" " ";"] ["-" "-"] (toLower content);
in /*html*/''
@ -40,7 +43,7 @@ in
buildPhase = /*sh*/''
runHook preBuild
${nte {inherit extraArgs entries templates;}}
${_nte.buildScript}
runHook postBuild
'';

View file

@ -1,6 +1,5 @@
_: {
template = "base";
file = "index.html";
head = /*html*/''
<title>nte example</title>

View file

@ -1,13 +1,13 @@
{
getEntry,
pkgs,
...
} @ entryArgs: let
}: let
inherit (pkgs) lib;
inherit (lib.lists) map;
inherit (lib.strings) concatStrings;
in {
template = "base";
file = "posts/index.html";
head = /*html*/''
<title>nte posts</title>
@ -25,7 +25,7 @@ in {
'';
in /*html*/''
<div id="posts">
${concatStrings (map (postFile: postItem ((import postFile) entryArgs))
${concatStrings (map (postFile: postItem (getEntry postFile))
[
./test.nix
]

View file

@ -3,7 +3,6 @@
...
}: {
template = "post";
file = "posts/test.html";
title = "Test post (using nte)";
author = "jacekpoz";

View file

@ -4,6 +4,7 @@
...
}: {
name = "base";
format = "html";
output = /*html*/''
<html>

View file

@ -4,14 +4,11 @@
created,
content,
...
} @ extraArgs : let
inherit (extraArgs) file;
in {
}: {
name = "post";
output = {
template = "base";
inherit file;
head = /*html*/''
<title>${title}</title>

View file

@ -14,7 +14,7 @@
system: let
pkgs = pkgsForEach.${system};
in {
default = import ./engine.nix pkgs;
default = import ./engine.nix pkgs ./example;
}
);