feat: add devshell and improve input handling of cells

pass system to cells and their flake.nix inputs
This commit is contained in:
technofab 2025-08-06 10:13:34 +02:00
parent 2774f3ea91
commit c9c329ec0f
No known key found for this signature in database
9 changed files with 62 additions and 5 deletions

2
.envrc Normal file
View file

@ -0,0 +1,2 @@
source $(fetchurl https://gitlab.com/rensa-nix/direnv/-/raw/v0.2.0/direnvrc "sha256-PFFxlZWNz/LLuNHA1Zpu2qdC3MF+oukv/TxFj5Utixk=")
use ren //repo/devShells/default

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
result
.ren

7
cells/repo/devShells.nix Normal file
View file

@ -0,0 +1,7 @@
{inputs, ...}: let
inherit (inputs) pkgs devshellLib;
in {
default = devshellLib.mkShell {
packages = [pkgs.alejandra];
};
}

28
cells/repo/flake.lock generated Normal file
View file

@ -0,0 +1,28 @@
{
"nodes": {
"devshell": {
"locked": {
"dir": "lib",
"lastModified": 1753958239,
"narHash": "sha256-J0B5rfQAza9UKSqnKINn++AsrMWxG3/oTqVUt3QRlWk=",
"owner": "rensa-nix",
"repo": "devshell",
"rev": "fbacfc149b59acf68efa97951418a9a7a7022707",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "rensa-nix",
"repo": "devshell",
"type": "gitlab"
}
},
"root": {
"inputs": {
"devshell": "devshell"
}
}
},
"root": "root",
"version": 7
}

14
cells/repo/flake.nix Normal file
View file

@ -0,0 +1,14 @@
{
inputs = {
devshell.url = "gitlab:rensa-nix/devshell?dir=lib";
};
outputs = i:
i
// rec {
pkgs = import i.parent.nixpkgs {
inherit (i) system;
};
devshellLib = i.devshell.lib {inherit pkgs;};
};
}

View file

@ -1,6 +1,3 @@
{
inputs,
cell,
}: {
hello = "world";
}

View file

@ -13,6 +13,7 @@
cellsFrom = ./cells;
cellBlocks = with rensa.blocks; [
(simple "test")
(simple "devShells")
];
} {};
}

View file

@ -22,7 +22,13 @@
cell = cells // {__cr = [cellName cellBlock.name];};
additionalInputs =
if l.pathExists cellP.flake
then (callFlake (builtins.dirOf cellP.flake) {root.parent = inputs;}).outputs
then
(callFlake (builtins.dirOf cellP.flake) {
root = {
parent = inputs;
system = system;
};
}).outputs
else {};
in
importSignatureFor system cell cells additionalInputs;

View file

@ -28,7 +28,7 @@
inherit self;
cells = deSystemize system cells;
};
inherit cell;
inherit cell system;
};
in {
inherit deSystemize createImportSignature;