mirror of
https://gitlab.com/rensa-nix/core.git
synced 2025-12-11 22:00:09 +01:00
feat: add transformInputs which allows initializing inputs
This commit is contained in:
parent
7222ac48cd
commit
9f20f8c94b
7 changed files with 25 additions and 17 deletions
|
|
@ -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!";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
|
||||
};
|
||||
|
||||
outputs = inputs: import ./. {
|
||||
inherit (inputs.nixpkgs-lib) lib;
|
||||
};
|
||||
outputs = inputs:
|
||||
import ./. {
|
||||
inherit (inputs.nixpkgs-lib) lib;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue