From fac9a1ef95208757a13c2e73c01d73f0d95e6b63 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 13 Sep 2024 15:18:39 +0200 Subject: [PATCH] fix several function args --- engine.nix | 10 +++++----- stdlib.nix | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engine.nix b/engine.nix index 97f435d..b609714 100644 --- a/engine.nix +++ b/engine.nix @@ -12,16 +12,16 @@ pkgs: src: {extraArgs, entries, templates}: let args' = {inherit pkgs;} // extraArgs; args = args' // { - applyTemplate = applyTemplate args'; + applyTemplate = applyTemplate args' templates; findTemplateFn = findTemplateFn templates; - getEntry = getEntry args' src; + getEntry = getEntry args' templates src; }; processEntryFile = entryFile: let - foundTemplateFn = findTemplateFn templates entry; - entry = getEntry args src entryFile; + foundTemplateFn = findTemplateFn templates entry.template; + entry = getEntry args templates src entryFile; in - applyTemplate args foundTemplateFn entry; + applyTemplate args templates foundTemplateFn entry; in /*sh*/'' ${concatMapStrings diff --git a/stdlib.nix b/stdlib.nix index cc622d8..2294b6c 100644 --- a/stdlib.nix +++ b/stdlib.nix @@ -24,7 +24,7 @@ pkgs: let else (import template); - applyTemplate = extraArgs: templateFn: entry: let + applyTemplate = extraArgs: templates: templateFn: entry: let template = templateFn ({inherit pkgs;} // extraArgs // entry); in if isBaseTemplate template then { @@ -33,9 +33,9 @@ pkgs: let } else let newEntry = template.output // {inherit (entry) file;}; - foundTemplateFn = findTemplateFn newEntry; + foundTemplateFn = findTemplateFn templates newEntry.template; in - applyTemplate foundTemplateFn newEntry; + applyTemplate extraArgs templates foundTemplateFn newEntry; replaceSuffix = from: to: string: if !(hasSuffix from string) then @@ -43,7 +43,7 @@ pkgs: let else concatStrings [ (removeSuffix from string) to ]; - getTemplateFormat = extraArgs: entry: templateFn: let + getTemplateFormat = extraArgs: templates: entry: templateFn: let # getEntry needs to go down to the base template for the format # but any template through the way can ask for a file # so we just give it a placeholder - an empty string here @@ -54,15 +54,15 @@ pkgs: let template.format else let newEntry = template.output; - foundTemplateFn = findTemplateFn newEntry; + foundTemplateFn = findTemplateFn templates newEntry.template; in - getTemplateFormat newEntry foundTemplateFn; + getTemplateFormat extraArgs templates newEntry foundTemplateFn; - getEntry = extraArgs: sourceDir: entryFile: let + getEntry = extraArgs: templates: sourceDir: entryFile: let sourceFile = toString (removePrefix sourceDir entryFile); entry = (import entryFile) ({inherit pkgs;} // extraArgs); - foundTemplateFn = findTemplateFn entry; - entryFormat = getTemplateFormat entry foundTemplateFn; + foundTemplateFn = findTemplateFn templates entry.template; + entryFormat = getTemplateFormat extraArgs templates entry foundTemplateFn; in if !(hasAttr "file" entry) then entry // {