diff --git a/cells/repo/devShells.nix b/cells/repo/devShells.nix index d7583f9..da51059 100644 --- a/cells/repo/devShells.nix +++ b/cells/repo/devShells.nix @@ -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!"; }; } diff --git a/cells/repo/flake.nix b/cells/repo/flake.nix index 2cb1932..a958cee 100644 --- a/cells/repo/flake.nix +++ b/cells/repo/flake.nix @@ -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;}; }; } diff --git a/flake.nix b/flake.nix index ff0ae96..1c28da0 100644 --- a/flake.nix +++ b/flake.nix @@ -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") diff --git a/lib/core/builder.nix b/lib/core/builder.nix index 9418e65..655a8f7 100644 --- a/lib/core/builder.nix +++ b/lib/core/builder.nix @@ -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); diff --git a/lib/core/loader.nix b/lib/core/loader.nix index 808b488..184080b 100644 --- a/lib/core/loader.nix +++ b/lib/core/loader.nix @@ -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; diff --git a/lib/flake.nix b/lib/flake.nix index d530c91..f0d1fbb 100644 --- a/lib/flake.nix +++ b/lib/flake.nix @@ -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; + }; } diff --git a/lib/utils/import-signature.nix b/lib/utils/import-signature.nix index 840f030..3c60055 100644 --- a/lib/utils/import-signature.nix +++ b/lib/utils/import-signature.nix @@ -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 {