From f0f5525a4e9713b775fffc592c476df2c857fec0 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 22 Jun 2023 17:45:05 -0500 Subject: [PATCH] feat: add inputs argument to actions allows actions to work on the same set of inputs passed to the target --- grow/default.nix | 4 ++-- grow/newExtractFor.nix | 4 ++-- types/default.nix | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/grow/default.nix b/grow/default.nix index 08b5496..d54686f 100644 --- a/grow/default.nix +++ b/grow/default.nix @@ -105,6 +105,7 @@ blockP = paths.cellBlockPath cellP cellBlock; isFile = l.pathExists blockP.file; isDir = l.pathExists blockP.dir; + signature = _ImportSignatureFor res.output cellP.flake; # recursion on cell import' = { displayPath, importPath, @@ -114,7 +115,6 @@ block = Block "paisano/import: ${displayPath}" (l.scopedImport signature importPath); - signature = _ImportSignatureFor res.output cellP.flake; # recursion on cell in if l.typeOf block == "set" then block @@ -135,7 +135,7 @@ imported = Target' importPaths (import' importPaths); # extract instatiates actions and extracts metadata for the __std registry targetTracer = name: l.traceVerbose "Paisano loading for ${system} ${importPaths.importPath}:${name}"; - extracted = l.optionalAttrs (cellBlock.cli or true) (l.mapAttrs (_extract cellBlock targetTracer) imported); + extracted = l.optionalAttrs (cellBlock.cli or true) (l.mapAttrs (_extract cellBlock targetTracer signature.inputs) imported); in optionalLoad (isFile || isDir) [ diff --git a/grow/newExtractFor.nix b/grow/newExtractFor.nix index 3b6c466..c92773a 100644 --- a/grow/newExtractFor.nix +++ b/grow/newExtractFor.nix @@ -5,7 +5,7 @@ This file implements an extractor that feeds the registry. l, paths, types, -}: cellsFrom: system: cellName: cellBlock: targetTracer: name: target: let +}: cellsFrom: system: cellName: cellBlock: targetTracer: inputs: name: target: let tPath = paths.targetPath cellsFrom cellName cellBlock name; fragment = ''"${system}"."${cellName}"."${cellBlock.name}"."${name}"''; actions' = @@ -14,7 +14,7 @@ This file implements an extractor that feeds the registry. l.listToAttrs ( map (a: l.nameValuePair a.name a) (cellBlock.actions { - inherit target fragment; + inherit target fragment inputs; fragmentRelPath = "${cellName}/${cellBlock.name}/${name}"; # in impure mode, detect the current system to run # the action's executables themselves with correct arch diff --git a/types/default.nix b/types/default.nix index b69e420..2ccb94d 100644 --- a/types/default.nix +++ b/types/default.nix @@ -26,6 +26,7 @@ ci = option (attrs bool); cli = option bool; actions = option (functionWithArgs { + inputs = false; target = false; fragment = false; fragmentRelPath = false;