move getEntry to extraArgs instead of making the user add it
This commit is contained in:
parent
b9dfa1bd7e
commit
d31fd244af
2 changed files with 11 additions and 18 deletions
24
engine.nix
24
engine.nix
|
@ -8,7 +8,7 @@ pkgs: src: {extraArgs, entries, templates}: let
|
||||||
inherit (lib.strings) concatMapStrings concatStrings escapeShellArg hasSuffix isString removeSuffix;
|
inherit (lib.strings) concatMapStrings concatStrings escapeShellArg hasSuffix isString removeSuffix;
|
||||||
inherit (lib.trivial) functionArgs;
|
inherit (lib.trivial) functionArgs;
|
||||||
|
|
||||||
args = {inherit pkgs;}
|
args = {inherit pkgs getEntry;}
|
||||||
// (import ./stdlib.nix pkgs)
|
// (import ./stdlib.nix pkgs)
|
||||||
// extraArgs;
|
// extraArgs;
|
||||||
|
|
||||||
|
@ -84,16 +84,12 @@ pkgs: src: {extraArgs, entries, templates}: let
|
||||||
else
|
else
|
||||||
entry;
|
entry;
|
||||||
|
|
||||||
in {
|
in /*sh*/''
|
||||||
inherit getEntry;
|
${concatMapStrings
|
||||||
|
(result: /*sh*/''
|
||||||
buildScript = /*sh*/''
|
mkdir -p $out/${dirOf result.file}
|
||||||
${concatMapStrings
|
echo ${escapeShellArg result.output} > $out/${result.file}
|
||||||
(result: /*sh*/''
|
'')
|
||||||
mkdir -p $out/${dirOf result.file}
|
(forEach entries processEntryFile)
|
||||||
echo ${escapeShellArg result.output} > $out/${result.file}
|
}
|
||||||
'')
|
''
|
||||||
(forEach entries processEntryFile)
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
inherit (lib.lists) map;
|
inherit (lib.lists) map;
|
||||||
inherit (lib.strings) replaceStrings toLower;
|
inherit (lib.strings) replaceStrings toLower;
|
||||||
|
|
||||||
_nte = nte {inherit extraArgs entries templates;};
|
|
||||||
|
|
||||||
extraArgs = {
|
extraArgs = {
|
||||||
inherit (_nte) getEntry;
|
|
||||||
h = n: content: let
|
h = n: content: let
|
||||||
id = replaceStrings [" " ";"] ["-" "-"] (toLower content);
|
id = replaceStrings [" " ";"] ["-" "-"] (toLower content);
|
||||||
in /*html*/''
|
in /*html*/''
|
||||||
|
@ -43,7 +40,7 @@ in
|
||||||
buildPhase = /*sh*/''
|
buildPhase = /*sh*/''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
${_nte.buildScript}
|
${nte {inherit extraArgs entries templates;}}
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue