feat: add transformInputs which allows initializing inputs

This commit is contained in:
technofab 2025-08-15 15:29:49 +02:00
parent 7222ac48cd
commit 9f20f8c94b
No known key found for this signature in database
7 changed files with 25 additions and 17 deletions

View file

@ -1,7 +1,8 @@
{inputs, ...}: let
inherit (inputs) pkgs devshellLib;
inherit (inputs) pkgs dslib;
in {
default = devshellLib.mkShell {
default = dslib.mkShell {
packages = [pkgs.alejandra];
enterShellCommands."ren".text = "echo Hello rensa!";
};
}

View file

@ -5,10 +5,7 @@
outputs = i:
i
// rec {
pkgs = import i.parent.nixpkgs {
inherit (i) system;
};
devshellLib = i.devshell.lib {inherit pkgs;};
// {
dslib = i.devshell.lib {inherit (i.parent) pkgs;};
};
}

View file

@ -11,6 +11,11 @@
in
rensa.buildWith {
inherit inputs;
transformInputs = system: i:
i
// {
pkgs = import i.nixpkgs {inherit system;};
};
cellsFrom = ./cells;
cellBlocks = with rensa.blocks; [
(simple "test")

View file

@ -10,6 +10,7 @@
inputs,
cellsFrom,
cellBlocks,
transformInputs ? system: i: i,
systems ? [
"x86_64-linux"
"aarch64-linux"
@ -21,7 +22,7 @@
loadOutputFor = system: let
loadCell = createCellLoader {
inherit inputs system cells cellsFrom cellBlocks;
inherit inputs system cells cellsFrom cellBlocks transformInputs;
};
cells' = l.mapAttrsToList (cell: type: cell) (l.readDir cellsFrom);

View file

@ -10,8 +10,9 @@
inputs,
system,
cells,
transformInputs,
}: let
importSignatureFor = createImportSignature {inherit inputs;};
importSignatureFor = createImportSignature {inherit inputs transformInputs;};
loadCellBlock = cellName: cellP: cellBlock: let
blockP = paths.cellBlockPath cellP cellBlock;
@ -25,8 +26,8 @@
then
(callFlake (builtins.dirOf cellP.flake) {
root = {
parent = inputs;
system = system;
parent = transformInputs system inputs;
inherit system;
};
}).outputs
else {};
@ -121,9 +122,10 @@
cells,
cellsFrom,
cellBlocks,
transformInputs,
}: let
inherit (utils) unique accumulate;
loadCellBlock = createCellBlockLoader {inherit inputs system cells;};
loadCellBlock = createCellBlockLoader {inherit inputs system cells transformInputs;};
loadCell = cellName: let
cellP = paths.cellPath cellsFrom cellName;

View file

@ -3,7 +3,8 @@
nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
};
outputs = inputs: import ./. {
outputs = inputs:
import ./. {
inherit (inputs.nixpkgs-lib) lib;
};
}

View file

@ -22,12 +22,13 @@
rev = cfg.inputs.self.sourceInfo.rev or "not-a-commit";
};
in {
inputs =
inputs = cfg.transformInputs system (
(deSystemize system (cfg.inputs // additionalInputs))
// {
inherit self;
cells = deSystemize system cells;
};
}
);
inherit cell system;
};
in {