From f6bc03bea742f0c9232c0389a19f511d8729ef77 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Sat, 25 May 2024 17:16:01 +0200 Subject: [PATCH] update example to work with latest changes --- example/default.nix | 5 ++++- example/index.nix | 1 - example/posts/index.nix | 6 +++--- example/posts/test.nix | 1 - example/templates/base.nix | 1 + example/templates/post.nix | 5 +---- flake.nix | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/example/default.nix b/example/default.nix index fd6d5fe..ea0368a 100644 --- a/example/default.nix +++ b/example/default.nix @@ -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 ''; diff --git a/example/index.nix b/example/index.nix index 904ea09..3a8d20f 100644 --- a/example/index.nix +++ b/example/index.nix @@ -1,6 +1,5 @@ _: { template = "base"; - file = "index.html"; head = /*html*/'' nte example diff --git a/example/posts/index.nix b/example/posts/index.nix index 27355ce..0364c4c 100644 --- a/example/posts/index.nix +++ b/example/posts/index.nix @@ -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*/'' nte posts @@ -25,7 +25,7 @@ in { ''; in /*html*/''
- ${concatStrings (map (postFile: postItem ((import postFile) entryArgs)) + ${concatStrings (map (postFile: postItem (getEntry postFile)) [ ./test.nix ] diff --git a/example/posts/test.nix b/example/posts/test.nix index 026baec..c2310e3 100644 --- a/example/posts/test.nix +++ b/example/posts/test.nix @@ -3,7 +3,6 @@ ... }: { template = "post"; - file = "posts/test.html"; title = "Test post (using nte)"; author = "jacekpoz"; diff --git a/example/templates/base.nix b/example/templates/base.nix index 98b4d67..bf9f291 100644 --- a/example/templates/base.nix +++ b/example/templates/base.nix @@ -4,6 +4,7 @@ ... }: { name = "base"; + format = "html"; output = /*html*/'' diff --git a/example/templates/post.nix b/example/templates/post.nix index 5186e74..5e9f7f4 100644 --- a/example/templates/post.nix +++ b/example/templates/post.nix @@ -4,14 +4,11 @@ created, content, ... -} @ extraArgs : let - inherit (extraArgs) file; -in { +}: { name = "post"; output = { template = "base"; - inherit file; head = /*html*/'' ${title} diff --git a/flake.nix b/flake.nix index 7f4f839..5a1d4d8 100644 --- a/flake.nix +++ b/flake.nix @@ -14,7 +14,7 @@ system: let pkgs = pkgsForEach.${system}; in { - default = import ./engine.nix pkgs; + default = import ./engine.nix pkgs ./example; } );