lib.clan: properly merge self attrs

This commit is contained in:
Johannes Kirschbauer
2025-07-01 13:39:53 +02:00
parent 27a3333c9e
commit d785169fbf
2 changed files with 15 additions and 4 deletions

View File

@@ -4,9 +4,10 @@
...
}:
let
testFlake = (clanLib.clan {
self = { };
directory = ./vm;
testFlake =
(clanLib.clan {
self = { };
directory = ./vm;
machines.jon = {
nixpkgs.hostPlatform = "x86_64-linux";

View File

@@ -26,7 +26,17 @@ in
This is used to import external clan modules.
'';
# Workaround for lib.clan
apply = v: if lib.isAttrs v then v // { inputs.self.clan = config; } else v;
apply =
s:
if lib.isAttrs s then
s
// {
inputs = (s.inputs or { }) // {
self.clan = config;
};
}
else
s;
};
directory = lib.mkOption {