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; } );