mirror of
https://gitlab.com/rensa-nix/core.git
synced 2026-02-02 07:15:08 +01:00
Compare commits
No commits in common. "main" and "v0.1.1" have entirely different histories.
22 changed files with 66 additions and 627 deletions
|
|
@ -3,19 +3,8 @@
|
||||||
in
|
in
|
||||||
cilib.mkCI {
|
cilib.mkCI {
|
||||||
pipelines."default" = {
|
pipelines."default" = {
|
||||||
stages = ["test" "build" "deploy"];
|
stages = ["build" "deploy"];
|
||||||
jobs = {
|
jobs = {
|
||||||
"test:lib" = {
|
|
||||||
stage = "test";
|
|
||||||
script = [
|
|
||||||
"nix run .#tests -- --junit=junit.xml"
|
|
||||||
];
|
|
||||||
allow_failure = true;
|
|
||||||
artifacts = {
|
|
||||||
when = "always";
|
|
||||||
reports.junit = "junit.xml";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"docs" = {
|
"docs" = {
|
||||||
stage = "build";
|
stage = "build";
|
||||||
script = [
|
script = [
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ in
|
||||||
{"API Reference" = "api.md";}
|
{"API Reference" = "api.md";}
|
||||||
{"Related Libraries" = "libraries.md";}
|
{"Related Libraries" = "libraries.md";}
|
||||||
{"Direnv Integration" = "direnv.md";}
|
{"Direnv Integration" = "direnv.md";}
|
||||||
{"Debugging" = "debugging.md";}
|
|
||||||
];
|
];
|
||||||
markdown_extensions = [
|
markdown_extensions = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
43
cells/repo/flake.lock
generated
43
cells/repo/flake.lock
generated
|
|
@ -3,11 +3,11 @@
|
||||||
"devshell": {
|
"devshell": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"lastModified": 1767218348,
|
"lastModified": 1758204313,
|
||||||
"narHash": "sha256-8MJqwH9sRMuHH+RsB7iqWyWD30TgmpiYKEvegAULggs=",
|
"narHash": "sha256-ainbY0Oajb1HMdvy+A8QxF/P5qwcbEzJGEY5pzKdDdc=",
|
||||||
"owner": "rensa-nix",
|
"owner": "rensa-nix",
|
||||||
"repo": "devshell",
|
"repo": "devshell",
|
||||||
"rev": "7a9b7e5d9f162a1fa3edfdc0169cdc29d3a67f8e",
|
"rev": "7d0c4bc78d9f017a739b0c7eb2f4e563118353e6",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -20,11 +20,11 @@
|
||||||
"devtools-lib": {
|
"devtools-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"lastModified": 1767214272,
|
"lastModified": 1766237846,
|
||||||
"narHash": "sha256-gvW7flZ60xdv3Z3Ksec5jcRjW2sqRHsGoJdwsNWQVPk=",
|
"narHash": "sha256-7n3WFabnf49SFHXD/e4zfLit3BniZZOecUXfBm3d1d0=",
|
||||||
"owner": "rensa-nix",
|
"owner": "rensa-nix",
|
||||||
"repo": "devtools",
|
"repo": "devtools",
|
||||||
"rev": "f40e59c32c48cdbf4cbc621c2f0f11e7bb80dbd3",
|
"rev": "5c8712f48c5bcb6b79d3da1afd1268f84f5e35e3",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -55,11 +55,11 @@
|
||||||
"nixmkdocs": {
|
"nixmkdocs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"lastModified": 1766404754,
|
"lastModified": 1766062227,
|
||||||
"narHash": "sha256-EjBe6x6BT8ckPirMWhSf1GfaFxORYxR/Uu71FvSAm60=",
|
"narHash": "sha256-jhr5CUi9eDeMIAJn7ayXP8Wr+Y2loV5EhdDIKDkRIdw=",
|
||||||
"owner": "TECHNOFAB",
|
"owner": "TECHNOFAB",
|
||||||
"repo": "nixmkdocs",
|
"repo": "nixmkdocs",
|
||||||
"rev": "cfa9606eeeb9288e2799896d7d42b3d3860f9ccb",
|
"rev": "cb0bb5dc3382e8ba5d81324a2f1fd94ccd5a5df4",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -69,31 +69,12 @@
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixtest-lib": {
|
|
||||||
"locked": {
|
|
||||||
"dir": "lib",
|
|
||||||
"lastModified": 1765728058,
|
|
||||||
"narHash": "sha256-V3FXECl1oTxEtGteNz3o3GJs/X8asSn1TxRpZ2F+htU=",
|
|
||||||
"owner": "TECHNOFAB",
|
|
||||||
"repo": "nixtest",
|
|
||||||
"rev": "2477ad31ae3aa4134e1bb5eeddbebe0cb64ccb57",
|
|
||||||
"type": "gitlab"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"dir": "lib",
|
|
||||||
"owner": "TECHNOFAB",
|
|
||||||
"ref": "v1.2.1",
|
|
||||||
"repo": "nixtest",
|
|
||||||
"type": "gitlab"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
"devtools-lib": "devtools-lib",
|
"devtools-lib": "devtools-lib",
|
||||||
"nix-gitlab-ci-lib": "nix-gitlab-ci-lib",
|
"nix-gitlab-ci-lib": "nix-gitlab-ci-lib",
|
||||||
"nixmkdocs": "nixmkdocs",
|
"nixmkdocs": "nixmkdocs",
|
||||||
"nixtest-lib": "nixtest-lib",
|
|
||||||
"soonix-lib": "soonix-lib",
|
"soonix-lib": "soonix-lib",
|
||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
}
|
}
|
||||||
|
|
@ -118,11 +99,11 @@
|
||||||
"treefmt-nix": {
|
"treefmt-nix": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1767122417,
|
"lastModified": 1766000401,
|
||||||
"narHash": "sha256-yOt/FTB7oSEKQH9EZMFMeuldK1HGpQs2eAzdS9hNS/o=",
|
"narHash": "sha256-+cqN4PJz9y0JQXfAK5J1drd0U05D5fcAGhzhfVrDlsI=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "dec15f37015ac2e774c84d0952d57fcdf169b54d",
|
"rev": "42d96e75aa56a3f70cab7e7dc4a32868db28e8fd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
soonix-lib.url = "gitlab:TECHNOFAB/soonix?dir=lib";
|
soonix-lib.url = "gitlab:TECHNOFAB/soonix?dir=lib";
|
||||||
nix-gitlab-ci-lib.url = "gitlab:TECHNOFAB/nix-gitlab-ci/3.1.2?dir=lib";
|
nix-gitlab-ci-lib.url = "gitlab:TECHNOFAB/nix-gitlab-ci/3.1.2?dir=lib";
|
||||||
devtools-lib.url = "gitlab:rensa-nix/devtools?dir=lib";
|
devtools-lib.url = "gitlab:rensa-nix/devtools?dir=lib";
|
||||||
nixtest-lib.url = "gitlab:TECHNOFAB/nixtest/v1.2.1?dir=lib";
|
|
||||||
treefmt-nix = {
|
treefmt-nix = {
|
||||||
url = "github:numtide/treefmt-nix";
|
url = "github:numtide/treefmt-nix";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
|
@ -19,8 +18,6 @@
|
||||||
doclib = i.nixmkdocs.lib {inherit (i.parent) pkgs;};
|
doclib = i.nixmkdocs.lib {inherit (i.parent) pkgs;};
|
||||||
soonix = i.soonix-lib.lib {inherit (i.parent) pkgs;};
|
soonix = i.soonix-lib.lib {inherit (i.parent) pkgs;};
|
||||||
cilib = i.nix-gitlab-ci-lib.lib {inherit (i.parent) pkgs;};
|
cilib = i.nix-gitlab-ci-lib.lib {inherit (i.parent) pkgs;};
|
||||||
ntlib = i.nixtest-lib.lib {inherit (i.parent) pkgs;};
|
|
||||||
rensa = import "${i.parent.self}/lib" {inherit (i.parent.pkgs) lib;};
|
|
||||||
treefmt = import i.treefmt-nix;
|
treefmt = import i.treefmt-nix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
{inputs, ...}: let
|
|
||||||
inherit (inputs) pkgs ntlib rensa;
|
|
||||||
in {
|
|
||||||
tests = ntlib.mkNixtest {
|
|
||||||
modules = ntlib.autodiscover {dir = "${inputs.self}/tests";};
|
|
||||||
args = {
|
|
||||||
inherit pkgs ntlib rensa;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
43
docs/api.md
43
docs/api.md
|
|
@ -8,7 +8,7 @@ The main entry point for creating a Rensa flake.
|
||||||
|
|
||||||
- `inputs`: The flake inputs.
|
- `inputs`: The flake inputs.
|
||||||
- `cellsFrom`: Path to the directory containing your cells.
|
- `cellsFrom`: Path to the directory containing your cells.
|
||||||
- `cellBlocks`: A list of blocks to load for each cell. Defaults to `[rensa.blocks.autodiscover]`.
|
- `cellBlocks`: A list of blocks to load for each cell.
|
||||||
- `transformInputs` (optional): A function to transform inputs before they are passed to cells.
|
- `transformInputs` (optional): A function to transform inputs before they are passed to cells.
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
@ -23,7 +23,7 @@ The underlying builder function used by `buildWith`. It returns the raw Rensa ou
|
||||||
|
|
||||||
- `inputs`: The flake inputs.
|
- `inputs`: The flake inputs.
|
||||||
- `cellsFrom`: Path to the directory containing your cells.
|
- `cellsFrom`: Path to the directory containing your cells.
|
||||||
- `cellBlocks`: A list of blocks to load for each cell. Defaults to `[rensa.blocks.autodiscover]`.
|
- `cellBlocks`: A list of blocks to load for each cell.
|
||||||
- `transformInputs` (optional): A function to transform inputs.
|
- `transformInputs` (optional): A function to transform inputs.
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
@ -56,45 +56,6 @@ by passing through actions etc. from a cell.
|
||||||
|
|
||||||
Currently not really used.
|
Currently not really used.
|
||||||
|
|
||||||
### `autodiscover`
|
|
||||||
|
|
||||||
```nix
|
|
||||||
autodiscover
|
|
||||||
# or
|
|
||||||
(autodiscover "cellName")
|
|
||||||
```
|
|
||||||
|
|
||||||
Automatically discovers and loads all cell blocks by scanning the cells directory for `.nix` files.
|
|
||||||
When `autodiscover` is present in `cellBlocks`, Rensa will:
|
|
||||||
|
|
||||||
1. Walk through all cells in `cellsFrom` (or specific cell if provided).
|
|
||||||
1. Find all `.nix` files (excluding `flake.nix`).
|
|
||||||
1. Find all directories containing `default.nix`.
|
|
||||||
1. Generate `simple` block definitions for each discovered block.
|
|
||||||
|
|
||||||
**Usage patterns:**
|
|
||||||
|
|
||||||
```nix
|
|
||||||
# full autodiscovery
|
|
||||||
cellBlocks = with rensa.blocks; [
|
|
||||||
autodiscover
|
|
||||||
];
|
|
||||||
# or
|
|
||||||
cellBlocks = with rensa.blocks; [
|
|
||||||
(autodiscover "backend") # only discover blocks from backend cell
|
|
||||||
(autodiscover "frontend") # only discover blocks from frontend cell
|
|
||||||
];
|
|
||||||
# mixed
|
|
||||||
cellBlocks = with rensa.blocks; [
|
|
||||||
(simple "myBlock") # explicit block (takes precedence)
|
|
||||||
autodiscover # discover all others
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
!!! note
|
|
||||||
|
|
||||||
When a block is both explicitly defined and discovered, the explicit definition takes precedence.
|
|
||||||
|
|
||||||
## `rensa.select`
|
## `rensa.select`
|
||||||
|
|
||||||
Helper to select specific outputs from the generated flake.
|
Helper to select specific outputs from the generated flake.
|
||||||
|
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
# Debugging
|
|
||||||
|
|
||||||
## Error Context
|
|
||||||
|
|
||||||
To help with debugging, Rensa uses Nix's `builtins.addErrorContext` to add context
|
|
||||||
about where an error is happening.
|
|
||||||
|
|
||||||
Use the following command to get just these logs from Rensa and please include that (or the whole stacktrace) in any issues or bug reports :)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
nix ... --show-trace 2> >(grep "… \[ren\]")
|
|
||||||
```
|
|
||||||
|
|
||||||
## Trace Verbose
|
|
||||||
|
|
||||||
There are also some `traceVerbose` calls in Rensa, so to debug non-failing executions
|
|
||||||
just run Nix with the `--trace-verbose` flag.
|
|
||||||
|
|
||||||
The output could look like this (example with this repo's flake):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
trace: [ren] loading cell block ci, type ci, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system aarch64-darwin
|
|
||||||
trace: [ren] loading cell block devShells, type devShells, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system aarch64-darwin
|
|
||||||
trace: [ren] loading cell block docs, type docs, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system aarch64-darwin
|
|
||||||
trace: [ren] loading cell block soonix, type soonix, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system aarch64-darwin
|
|
||||||
trace: [ren] loading cell block ci, type ci, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system aarch64-linux
|
|
||||||
trace: [ren] loading cell block devShells, type devShells, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system aarch64-linux
|
|
||||||
trace: [ren] loading cell block docs, type docs, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system aarch64-linux
|
|
||||||
trace: [ren] loading cell block soonix, type soonix, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system aarch64-linux
|
|
||||||
trace: [ren] loading cell block ci, type ci, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system x86_64-darwin
|
|
||||||
trace: [ren] loading cell block devShells, type devShells, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system x86_64-darwin
|
|
||||||
trace: [ren] loading cell block docs, type docs, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system x86_64-darwin
|
|
||||||
trace: [ren] loading cell block soonix, type soonix, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system x86_64-darwin
|
|
||||||
trace: [ren] loading cell block ci, type ci, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system x86_64-linux
|
|
||||||
trace: [ren] loading cell block devShells, type devShells, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system x86_64-linux
|
|
||||||
trace: [ren] loading cell block docs, type docs, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system x86_64-linux
|
|
||||||
trace: [ren] loading cell block soonix, type soonix, from cell /nix/store/7acz6q9360fkg0x187yx43d1vwpv850l-cells/repo, for system x86_64-linux
|
|
||||||
```
|
|
||||||
12
flake.lock
generated
12
flake.lock
generated
|
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1767151656,
|
"lastModified": 1766125104,
|
||||||
"narHash": "sha256-ujL2AoYBnJBN262HD95yer7QYUmYp5kFZGYbyCCKxq8=",
|
"narHash": "sha256-l/YGrEpLromL4viUo5GmFH3K5M1j0Mb9O+LiaeCPWEM=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "f665af0cdb70ed27e1bd8f9fdfecaf451260fc55",
|
"rev": "7d853e518814cca2a657b72eeba67ae20ebf7059",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -18,11 +18,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1766884708,
|
"lastModified": 1765674936,
|
||||||
"narHash": "sha256-x8nyRwtD0HMeYtX60xuIuZJbwwoI7/UKAdCiATnQNz0=",
|
"narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "15177f81ad356040b4460a676838154cbf7f6213",
|
"rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,12 @@
|
||||||
(simple "docs")
|
(simple "docs")
|
||||||
(simple "ci")
|
(simple "ci")
|
||||||
(simple "soonix")
|
(simple "soonix")
|
||||||
(simple "tests")
|
|
||||||
];
|
];
|
||||||
} {
|
} {
|
||||||
packages = rensa.select inputs.self [
|
packages = rensa.select inputs.self [
|
||||||
["repo" "docs"]
|
["repo" "docs"]
|
||||||
["repo" "ci" "packages"]
|
["repo" "ci" "packages"]
|
||||||
["repo" "soonix" "packages"]
|
["repo" "soonix" "packages"]
|
||||||
["repo" "tests"]
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,6 @@
|
||||||
dynamic = name: {
|
dynamic = name: {
|
||||||
inherit name;
|
inherit name;
|
||||||
type = name;
|
type = name;
|
||||||
cli = true;
|
|
||||||
actions = args: {};
|
|
||||||
# TODO: dynamic actions
|
# TODO: dynamic actions
|
||||||
};
|
};
|
||||||
autodiscover = {
|
|
||||||
name = "__autodiscover";
|
|
||||||
type = "__autodiscover";
|
|
||||||
_functor = self: cell:
|
|
||||||
self
|
|
||||||
// {
|
|
||||||
inherit cell;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,98 +0,0 @@
|
||||||
{
|
|
||||||
l,
|
|
||||||
cellsFrom,
|
|
||||||
cellBlocks,
|
|
||||||
}: let
|
|
||||||
# find autodiscover blocks
|
|
||||||
autodiscoverBlocks = l.filter (block: block.name or "" == "__autodiscover") cellBlocks;
|
|
||||||
explicitBlocks = l.filter (block: block.name or "" != "__autodiscover") cellBlocks;
|
|
||||||
hasAutodiscover = (l.length autodiscoverBlocks) > 0;
|
|
||||||
|
|
||||||
# discover all block names from a single cell's directory
|
|
||||||
discoverBlocksFromCell = cellPath: let
|
|
||||||
cellContents = l.readDir cellPath;
|
|
||||||
# filter for .nix files (but not flake.nix) and dirs with default.nix
|
|
||||||
blockNames = l.unique (
|
|
||||||
l.filter (name: name != null) (
|
|
||||||
l.mapAttrsToList (
|
|
||||||
name: type:
|
|
||||||
if type == "regular" && l.hasSuffix ".nix" name && name != "flake.nix"
|
|
||||||
then l.removeSuffix ".nix" name
|
|
||||||
else if type == "directory" && l.pathExists (cellPath + "/${name}/default.nix")
|
|
||||||
then name
|
|
||||||
else null
|
|
||||||
)
|
|
||||||
cellContents
|
|
||||||
)
|
|
||||||
);
|
|
||||||
in
|
|
||||||
builtins.addErrorContext "[ren] while discovering blocks from cell ${cellPath}"
|
|
||||||
blockNames;
|
|
||||||
|
|
||||||
# discover all blocks from all cells or specific cells
|
|
||||||
discoverAllBlocks = let
|
|
||||||
# check if any autodiscover blocks have cell-specific targets (eg. `autodiscover "a"`)
|
|
||||||
cellSpecificDiscoveries = l.filter (block: block ? cell) autodiscoverBlocks;
|
|
||||||
globalDiscoveries = l.filter (block: !(block ? cell)) autodiscoverBlocks;
|
|
||||||
|
|
||||||
cellSpecificBlocks = l.flatten (
|
|
||||||
l.map (
|
|
||||||
block: let
|
|
||||||
cellPath = cellsFrom + "/${block.cell}";
|
|
||||||
in
|
|
||||||
if l.pathExists cellPath
|
|
||||||
then discoverBlocksFromCell cellPath
|
|
||||||
else []
|
|
||||||
)
|
|
||||||
cellSpecificDiscoveries
|
|
||||||
);
|
|
||||||
|
|
||||||
# global autodiscover
|
|
||||||
globalBlocks = builtins.addErrorContext "[ren] while discovering global blocks" (
|
|
||||||
if (l.length globalDiscoveries) > 0
|
|
||||||
then let
|
|
||||||
cells = l.readDir cellsFrom;
|
|
||||||
allBlockNames = l.unique (
|
|
||||||
l.flatten (
|
|
||||||
l.mapAttrsToList (
|
|
||||||
cellName: cellType:
|
|
||||||
if cellType == "directory"
|
|
||||||
then discoverBlocksFromCell (cellsFrom + "/${cellName}")
|
|
||||||
else []
|
|
||||||
)
|
|
||||||
cells
|
|
||||||
)
|
|
||||||
);
|
|
||||||
in
|
|
||||||
allBlockNames
|
|
||||||
else []
|
|
||||||
);
|
|
||||||
|
|
||||||
allBlockNames = l.unique (cellSpecificBlocks ++ globalBlocks);
|
|
||||||
in
|
|
||||||
builtins.addErrorContext "[ren] while discovering all blocks"
|
|
||||||
l.map (name: {
|
|
||||||
inherit name;
|
|
||||||
type = name;
|
|
||||||
})
|
|
||||||
allBlockNames;
|
|
||||||
|
|
||||||
discoveredBlocks =
|
|
||||||
if hasAutodiscover
|
|
||||||
then discoverAllBlocks
|
|
||||||
else [];
|
|
||||||
|
|
||||||
# merge the explicit and autodiscovered blocks (explicit taking precedence)
|
|
||||||
allBlocks = explicitBlocks ++ discoveredBlocks;
|
|
||||||
uniqueBlocks =
|
|
||||||
l.foldl' (
|
|
||||||
acc: block:
|
|
||||||
# first occurence of name wins
|
|
||||||
if l.any (b: b.name == block.name) acc
|
|
||||||
then acc
|
|
||||||
else acc ++ [block]
|
|
||||||
) []
|
|
||||||
allBlocks;
|
|
||||||
in
|
|
||||||
builtins.addErrorContext "[ren] while autodiscovering cell blocks"
|
|
||||||
uniqueBlocks
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
l,
|
l,
|
||||||
utils,
|
utils,
|
||||||
loader,
|
loader,
|
||||||
autodiscover,
|
|
||||||
blocks,
|
|
||||||
}: let
|
}: let
|
||||||
inherit (utils) accumulate;
|
inherit (utils) accumulate;
|
||||||
inherit (loader) createCellLoader;
|
inherit (loader) createCellLoader;
|
||||||
|
|
@ -11,7 +9,7 @@
|
||||||
build = {
|
build = {
|
||||||
inputs,
|
inputs,
|
||||||
cellsFrom,
|
cellsFrom,
|
||||||
cellBlocks ? [blocks.autodiscover],
|
cellBlocks,
|
||||||
transformInputs ? system: i: i,
|
transformInputs ? system: i: i,
|
||||||
...
|
...
|
||||||
} @ args: let
|
} @ args: let
|
||||||
|
|
@ -30,31 +28,26 @@
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
cellBlocks' = autodiscover {inherit l cellsFrom cellBlocks;};
|
|
||||||
|
|
||||||
cells = res.output;
|
cells = res.output;
|
||||||
|
|
||||||
loadOutputFor = system: let
|
loadOutputFor = system: let
|
||||||
loadCell = createCellLoader {
|
loadCell = createCellLoader {
|
||||||
inherit inputs system cells cellsFrom transformInputs;
|
inherit inputs system cells cellsFrom cellBlocks transformInputs;
|
||||||
cellBlocks = cellBlocks';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
cells' = l.mapAttrsToList (cell: type: cell) (l.readDir cellsFrom);
|
cells' = l.mapAttrsToList (cell: type: cell) (l.readDir cellsFrom);
|
||||||
res = accumulate (l.map loadCell cells');
|
res = accumulate (l.map loadCell cells');
|
||||||
in
|
in [
|
||||||
builtins.addErrorContext "[ren] while loading output for ${system}" [
|
{${system} = res.output;}
|
||||||
{${system} = res.output;}
|
{${system} = res.actions;}
|
||||||
{${system} = res.actions;}
|
{
|
||||||
{
|
name = system;
|
||||||
name = system;
|
value = res.init;
|
||||||
value = res.init;
|
}
|
||||||
}
|
];
|
||||||
];
|
|
||||||
|
|
||||||
res = accumulate (l.map loadOutputFor systems);
|
res = accumulate (l.map loadOutputFor systems);
|
||||||
in
|
in
|
||||||
builtins.addErrorContext "[ren] while building rensa output"
|
|
||||||
res.output
|
res.output
|
||||||
// {
|
// {
|
||||||
__ren = {
|
__ren = {
|
||||||
|
|
@ -96,12 +89,10 @@
|
||||||
recursiveUpdate = lhs: rhs:
|
recursiveUpdate = lhs: rhs:
|
||||||
recursiveUpdateUntil g lhs rhs;
|
recursiveUpdateUntil g lhs rhs;
|
||||||
in
|
in
|
||||||
builtins.addErrorContext "[ren] while building rensa output (buildWith)" (
|
build args
|
||||||
build args
|
// {
|
||||||
// {
|
__functor = l.flip recursiveUpdate;
|
||||||
__functor = l.flip recursiveUpdate;
|
};
|
||||||
}
|
|
||||||
);
|
|
||||||
in {
|
in {
|
||||||
inherit build buildWith;
|
inherit build buildWith;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,5 +112,4 @@ ref: inputOverrides: let
|
||||||
)
|
)
|
||||||
lockFile.nodes;
|
lockFile.nodes;
|
||||||
in
|
in
|
||||||
builtins.addErrorContext "[ren] while loading flake lockfile ${ref}"
|
|
||||||
allNodes.${lockFile.root}
|
allNodes.${lockFile.root}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
{
|
{
|
||||||
l,
|
l,
|
||||||
utils,
|
utils,
|
||||||
blocks,
|
|
||||||
}: let
|
}: let
|
||||||
paths = import ./paths.nix;
|
paths = import ./paths.nix;
|
||||||
callFlake = import ./call-flake.nix;
|
callFlake = import ./call-flake.nix;
|
||||||
autodiscover = import ./autodiscover.nix;
|
|
||||||
loader = import ./loader.nix {inherit l utils paths callFlake;};
|
loader = import ./loader.nix {inherit l utils paths callFlake;};
|
||||||
builder = import ./builder.nix {inherit l utils loader autodiscover blocks;};
|
builder = import ./builder.nix {inherit l utils loader;};
|
||||||
in {
|
in {
|
||||||
inherit (builder) build buildWith;
|
inherit (builder) build buildWith;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,18 +33,14 @@
|
||||||
}).outputs
|
}).outputs
|
||||||
else {};
|
else {};
|
||||||
in
|
in
|
||||||
builtins.addErrorContext "[ren] while getting input signature for ${blockP}" (
|
importSignatureFor system updatedCell cells additionalInputs;
|
||||||
importSignatureFor system updatedCell cells additionalInputs
|
|
||||||
);
|
|
||||||
|
|
||||||
import' = importPath: let
|
import' = importPath: let
|
||||||
block = import importPath;
|
block = import importPath;
|
||||||
in
|
in
|
||||||
if l.typeOf block == "set"
|
if l.typeOf block == "set"
|
||||||
then block
|
then block
|
||||||
else
|
else block signature;
|
||||||
builtins.addErrorContext "[ren] while importing block at ${importPath}"
|
|
||||||
(block signature);
|
|
||||||
|
|
||||||
importPaths =
|
importPaths =
|
||||||
if isFile
|
if isFile
|
||||||
|
|
@ -105,20 +101,18 @@
|
||||||
in
|
in
|
||||||
optionalLoad (isFile || isDir) (
|
optionalLoad (isFile || isDir) (
|
||||||
assert l.assertMsg isAttrs "cell block does not return an attrset: ${importPaths.displayPath}";
|
assert l.assertMsg isAttrs "cell block does not return an attrset: ${importPaths.displayPath}";
|
||||||
l.traceVerbose "[ren] loading cell block ${cellBlock.name}, type ${cellBlock.type}, from cell ${cellP}, for system ${system}" (
|
l.traceVerbose "[ren] loading cell block ${cellBlock.name}, type ${cellBlock.type}, from cell ${cellP}"
|
||||||
builtins.addErrorContext "[ren] loading cell block ${cellBlock.name}, type ${cellBlock.type}, from cell ${cellP}, for system ${system}"
|
[
|
||||||
[
|
{${cellBlock.name} = imported;}
|
||||||
{${cellBlock.name} = imported;}
|
{${cellBlock.name} = l.mapAttrs (_: set: set.actions) extracted;}
|
||||||
{${cellBlock.name} = l.mapAttrs (_: set: set.actions) extracted;}
|
({
|
||||||
({
|
cellBlock = cellBlock.name;
|
||||||
cellBlock = cellBlock.name;
|
blockType = cellBlock.type;
|
||||||
blockType = cellBlock.type;
|
targets = l.mapAttrsToList (_: set: set.init) extracted;
|
||||||
targets = l.mapAttrsToList (_: set: set.init) extracted;
|
}
|
||||||
}
|
// (l.optionalAttrs (l.pathExists blockP.readmeDir) {readme = blockP.readmeDir;})
|
||||||
// (l.optionalAttrs (l.pathExists blockP.readmeDir) {readme = blockP.readmeDir;})
|
// (l.optionalAttrs (l.pathExists blockP.readme) {inherit (blockP) readme;}))
|
||||||
// (l.optionalAttrs (l.pathExists blockP.readme) {inherit (blockP) readme;}))
|
]
|
||||||
]
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
loadCellBlock;
|
loadCellBlock;
|
||||||
|
|
@ -139,7 +133,7 @@
|
||||||
# fixes `ìnfinite recursion` errors when accessing cell attributes from sibling blocks
|
# fixes `ìnfinite recursion` errors when accessing cell attributes from sibling blocks
|
||||||
# example: cells/test/a.nix returns `cell.b`, so the same thing as cells/test/b.nix.
|
# example: cells/test/a.nix returns `cell.b`, so the same thing as cells/test/b.nix.
|
||||||
# this would previously fail with infinite recursion, this makes it work:
|
# this would previously fail with infinite recursion, this makes it work:
|
||||||
cell = builtins.addErrorContext "[ren] while accessing cell '${cellName}' siblings" (l.listToAttrs (l.concatMap (
|
cell = l.listToAttrs (l.concatMap (
|
||||||
block: let
|
block: let
|
||||||
blockP = paths.cellBlockPath cellP block;
|
blockP = paths.cellBlockPath cellP block;
|
||||||
exists = l.pathExists blockP.file || l.pathExists blockP.dir;
|
exists = l.pathExists blockP.file || l.pathExists blockP.dir;
|
||||||
|
|
@ -154,19 +148,18 @@
|
||||||
]
|
]
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
cellBlocks'));
|
cellBlocks');
|
||||||
loadCellBlock = createCellBlockLoader {inherit inputs system cells cell transformInputs;};
|
loadCellBlock = createCellBlockLoader {inherit inputs system cells cell transformInputs;};
|
||||||
res = accumulate (l.map (loadCellBlock cellName cellP) cellBlocks');
|
res = accumulate (l.map (loadCellBlock cellName cellP) cellBlocks');
|
||||||
in
|
in [
|
||||||
builtins.addErrorContext "[ren] while loading cell ${cellName}" [
|
{${cellName} = res.output;}
|
||||||
{${cellName} = res.output;}
|
{${cellName} = res.actions;}
|
||||||
{${cellName} = res.actions;}
|
({
|
||||||
({
|
cell = cellName;
|
||||||
cell = cellName;
|
cellBlocks = res.init;
|
||||||
cellBlocks = res.init;
|
}
|
||||||
}
|
// (l.optionalAttrs (l.pathExists cellP.readme) {inherit (cellP) readme;}))
|
||||||
// (l.optionalAttrs (l.pathExists cellP.readme) {inherit (cellP) readme;}))
|
];
|
||||||
];
|
|
||||||
in
|
in
|
||||||
loadCell;
|
loadCell;
|
||||||
in {
|
in {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
{lib}: let
|
{lib}: let
|
||||||
l = builtins // lib;
|
l = builtins // lib;
|
||||||
blocks = import ./blocks;
|
|
||||||
utils = import ./utils {inherit l;};
|
utils = import ./utils {inherit l;};
|
||||||
|
core = import ./core {inherit l utils;};
|
||||||
compat = import ./compat {inherit l;};
|
compat = import ./compat {inherit l;};
|
||||||
core = import ./core {inherit l utils blocks;};
|
blocks = import ./blocks;
|
||||||
in {
|
in {
|
||||||
inherit (compat) filter select get;
|
inherit (compat) filter select get;
|
||||||
inherit (core) build buildWith;
|
inherit (core) build buildWith;
|
||||||
|
|
|
||||||
6
lib/flake.lock
generated
6
lib/flake.lock
generated
|
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1766884708,
|
"lastModified": 1754184128,
|
||||||
"narHash": "sha256-x8nyRwtD0HMeYtX60xuIuZJbwwoI7/UKAdCiATnQNz0=",
|
"narHash": "sha256-AjhoyBL4eSyXf01Bmc6DiuaMrJRNdWopmdnMY0Pa/M0=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "15177f81ad356040b4460a676838154cbf7f6213",
|
"rev": "02e72200e6d56494f4a7c0da8118760736e41b60",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
ntlib,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
suites."Autodiscovery" = {
|
|
||||||
pos = __curPos;
|
|
||||||
tests = [
|
|
||||||
{
|
|
||||||
name = "find nix files";
|
|
||||||
type = "script";
|
|
||||||
script = ''
|
|
||||||
${ntlib.helpers.path [pkgs.gnugrep pkgs.coreutils pkgs.nix]}
|
|
||||||
${ntlib.helpers.scriptHelpers}
|
|
||||||
|
|
||||||
mkdir -p "testcell"
|
|
||||||
echo '{ foo = "bar"; }' > "testcell/packages.nix"
|
|
||||||
echo '{ baz = "qux"; }' > "testcell/devShells.nix"
|
|
||||||
echo '{ ignored = true; }' > "testcell/flake.nix"
|
|
||||||
|
|
||||||
result=$(nix eval --impure --expr '
|
|
||||||
let
|
|
||||||
lib = import ${pkgs.path}/lib;
|
|
||||||
autodiscover = import ${../lib/core/autodiscover.nix} {
|
|
||||||
l = builtins // lib;
|
|
||||||
cellsFrom = ./.;
|
|
||||||
cellBlocks = [ { name = "__autodiscover"; } ];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
builtins.length (builtins.filter (b: b.name == "packages" || b.name == "devShells") autodiscover)
|
|
||||||
')
|
|
||||||
|
|
||||||
assert_eq "$result" "2" "should discover 2 blocks"
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "finds directories";
|
|
||||||
type = "script";
|
|
||||||
script = ''
|
|
||||||
${ntlib.helpers.path [pkgs.gnugrep pkgs.coreutils pkgs.nix]}
|
|
||||||
${ntlib.helpers.scriptHelpers}
|
|
||||||
|
|
||||||
mkdir -p "testcell/packages"
|
|
||||||
echo '{ hello = "world"; }' > "testcell/packages/default.nix"
|
|
||||||
|
|
||||||
result=$(nix eval --impure --expr '
|
|
||||||
let
|
|
||||||
lib = import ${pkgs.path}/lib;
|
|
||||||
autodiscover = import ${../lib/core/autodiscover.nix} {
|
|
||||||
l = builtins // lib;
|
|
||||||
cellsFrom = ./.;
|
|
||||||
cellBlocks = [ { name = "__autodiscover"; } ];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
builtins.any (b: b.name == "packages") autodiscover
|
|
||||||
')
|
|
||||||
|
|
||||||
assert "$result == true" "Should discover directory with default.nix"
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
ntlib,
|
|
||||||
rensa,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
suites."Builder" = {
|
|
||||||
pos = __curPos;
|
|
||||||
tests = [
|
|
||||||
{
|
|
||||||
name = "has system outputs";
|
|
||||||
expected = true;
|
|
||||||
actual = let
|
|
||||||
testFlake = rensa.build {
|
|
||||||
inputs = {};
|
|
||||||
cellsFrom = ../cells;
|
|
||||||
cellBlocks = with rensa.blocks; [
|
|
||||||
(simple "test")
|
|
||||||
];
|
|
||||||
systems = ["x86_64-linux"];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
builtins.hasAttr "x86_64-linux" testFlake;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "has ren metadata";
|
|
||||||
expected = true;
|
|
||||||
actual = let
|
|
||||||
testFlake = rensa.build {
|
|
||||||
inputs = {};
|
|
||||||
cellsFrom = ../cells;
|
|
||||||
cellBlocks = with rensa.blocks; [
|
|
||||||
(simple "test")
|
|
||||||
];
|
|
||||||
systems = ["x86_64-linux"];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
builtins.hasAttr "__ren" testFlake;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "merges outputs";
|
|
||||||
expected = {
|
|
||||||
packages = {
|
|
||||||
test-package = "merged";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
actual = let
|
|
||||||
testFlake =
|
|
||||||
rensa.buildWith {
|
|
||||||
inputs = {};
|
|
||||||
cellsFrom = ../cells;
|
|
||||||
cellBlocks = with rensa.blocks; [
|
|
||||||
(simple "test")
|
|
||||||
];
|
|
||||||
systems = ["x86_64-linux"];
|
|
||||||
} {
|
|
||||||
packages = {
|
|
||||||
test-package = "merged";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
packages = testFlake.packages;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "eval test";
|
|
||||||
type = "script";
|
|
||||||
script = ''
|
|
||||||
${ntlib.helpers.path [pkgs.gnugrep pkgs.coreutils pkgs.nix]}
|
|
||||||
${ntlib.helpers.scriptHelpers}
|
|
||||||
|
|
||||||
result=$(nix eval --impure --expr '
|
|
||||||
let
|
|
||||||
rensa = import ${../lib} {lib = import ${pkgs.path}/lib;};
|
|
||||||
testFlake = rensa.build {
|
|
||||||
inputs = { test = "value"; };
|
|
||||||
cellsFrom = ${../cells};
|
|
||||||
cellBlocks = [];
|
|
||||||
systems = [ "x86_64-linux" ];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
testFlake.__ren.__schema
|
|
||||||
')
|
|
||||||
|
|
||||||
assert "$result == \"v0\"" "should contain version"
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
{rensa, ...}: {
|
|
||||||
suites."Filter" = {
|
|
||||||
pos = __curPos;
|
|
||||||
tests = [
|
|
||||||
{
|
|
||||||
name = "filter by cell";
|
|
||||||
expected = {
|
|
||||||
x86_64-linux = {};
|
|
||||||
};
|
|
||||||
actual = let
|
|
||||||
testFlake = {
|
|
||||||
__ren = {
|
|
||||||
cells = ["repo" "other"];
|
|
||||||
};
|
|
||||||
x86_64-linux = {
|
|
||||||
repo = {
|
|
||||||
docs = {value = "docs-value";};
|
|
||||||
ci = {value = "ci-value";};
|
|
||||||
};
|
|
||||||
other = {
|
|
||||||
packages = {value = "other-packages";};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
rensa.filter (_: cell: cell == "repo") testFlake [["*" "*"]];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "filter by block";
|
|
||||||
expected = {
|
|
||||||
x86_64-linux = {};
|
|
||||||
};
|
|
||||||
actual = let
|
|
||||||
testFlake = {
|
|
||||||
__ren = {
|
|
||||||
cells = ["repo"];
|
|
||||||
};
|
|
||||||
x86_64-linux = {
|
|
||||||
repo = {
|
|
||||||
docs = {value = "docs-value";};
|
|
||||||
ci = {value = "ci-value";};
|
|
||||||
packages = {value = "packages-value";};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
rensa.filter (block: _: block == "docs") testFlake [["repo" "*"]];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
ntlib,
|
|
||||||
rensa,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
suites."Loader" = {
|
|
||||||
pos = __curPos;
|
|
||||||
tests = [
|
|
||||||
{
|
|
||||||
name = "cell sibling access";
|
|
||||||
expected = {
|
|
||||||
hello = "world";
|
|
||||||
};
|
|
||||||
actual = let
|
|
||||||
testFlake = rensa.build {
|
|
||||||
inputs = {};
|
|
||||||
cellsFrom = ../cells;
|
|
||||||
cellBlocks = with rensa.blocks; [
|
|
||||||
(simple "test")
|
|
||||||
];
|
|
||||||
systems = ["x86_64-linux"];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
testFlake.x86_64-linux.test.test;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "load file";
|
|
||||||
type = "script";
|
|
||||||
script = ''
|
|
||||||
${ntlib.helpers.path [pkgs.gnugrep pkgs.coreutils pkgs.nix]}
|
|
||||||
${ntlib.helpers.scriptHelpers}
|
|
||||||
|
|
||||||
mkdir -p "cells/testcell"
|
|
||||||
echo '{ hello = "world"; }' > "cells/testcell/packages.nix"
|
|
||||||
|
|
||||||
cat > "flake.nix" << 'EOF'
|
|
||||||
{
|
|
||||||
outputs = inputs: let
|
|
||||||
rensa = import ${../lib} { lib = import "${pkgs.path}/lib"; };
|
|
||||||
in rensa.build {
|
|
||||||
inputs = {};
|
|
||||||
cellsFrom = ./cells;
|
|
||||||
cellBlocks = with rensa.blocks; [ (simple "packages") ];
|
|
||||||
systems = [ "x86_64-linux" ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
result=$(nix eval --impure .#x86_64-linux.testcell.packages.hello)
|
|
||||||
|
|
||||||
assert "$result == \"world\"" "should equal to world"
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
{rensa, ...}: {
|
|
||||||
suites."Select" = {
|
|
||||||
pos = __curPos;
|
|
||||||
tests = [
|
|
||||||
{
|
|
||||||
name = "single block";
|
|
||||||
expected = {
|
|
||||||
x86_64-linux = {value = "test-value";};
|
|
||||||
};
|
|
||||||
actual = let
|
|
||||||
testFlake = {
|
|
||||||
__ren = {
|
|
||||||
cells = ["repo"];
|
|
||||||
};
|
|
||||||
x86_64-linux = {
|
|
||||||
repo = {
|
|
||||||
docs = {value = "test-value";};
|
|
||||||
ci = {packages = {value = "ci-packages";};};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
rensa.select testFlake [["repo" "docs"]];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "multiple blocks";
|
|
||||||
expected = {
|
|
||||||
x86_64-linux = {value = "ci-packages";};
|
|
||||||
};
|
|
||||||
actual = let
|
|
||||||
testFlake = {
|
|
||||||
__ren = {
|
|
||||||
cells = ["repo"];
|
|
||||||
};
|
|
||||||
x86_64-linux = {
|
|
||||||
repo = {
|
|
||||||
ci = {packages = {value = "ci-packages";};};
|
|
||||||
other = {value = "ignored";};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
rensa.select testFlake [
|
|
||||||
["repo" "ci" "packages"]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue