Skip to content

Commit

Permalink
feat: add inputs argument to actions
Browse files Browse the repository at this point in the history
allows actions to work on the same set of inputs passed to the target
  • Loading branch information
blaggacao committed Jun 22, 2023
1 parent 13d1901 commit f0f5525
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions grow/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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)
[
Expand Down
4 changes: 2 additions & 2 deletions grow/newExtractFor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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' =
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions types/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
ci = option (attrs bool);
cli = option bool;
actions = option (functionWithArgs {
inputs = false;
target = false;
fragment = false;
fragmentRelPath = false;
Expand Down

0 comments on commit f0f5525

Please sign in to comment.