Reorganize imports to prevent infinite recursions

This commit is contained in:
Fabian Hauser 2025-03-25 12:49:03 +02:00
parent ee6b756d3c
commit ff0ce9d94c
18 changed files with 136 additions and 89 deletions

View file

@ -1,37 +1,28 @@
{
self,
flakeSelf,
system,
private,
pkgs,
...
}:
with pkgs.lib;
let
inherit (self.lib) foldersWithNix;
inherit (pkgs.lib)
path
genAttrs
;
in
{
${system} =
let
packages = pipe (self.lib.foldersWithNix ./.) [
(map (name: {
inherit name;
path = path.append ./. "./${name}/default.nix";
}))
(map (
{ name, path }:
{
inherit name;
value = pkgs.callPackage path {
inherit self;
inherit system;
};
}
))
listToAttrs
];
in
packages
// {
default =
let
nixosConfigs = mapAttrsToList (n: v: v.config.system.build.toplevel) self.nixosConfigurations;
in
pkgs.linkFarmFromDrvs "all" (nixosConfigs ++ (attrValues packages));
};
${system} = genAttrs (foldersWithNix ./.) (
name:
pkgs.callPackage (path.append ./. "./${name}/default.nix") {
inherit
self
flakeSelf
system
private
;
}
);
}