fix: root module use module design pattern

This commit is contained in:
Emile Clark-Boman 2025-12-13 22:02:11 +10:00
parent 3d9e9740d2
commit 6a00621981

View file

@ -1,8 +1,20 @@
{systems, ...}: let {systems, ...}: let
std = import ./std; std = import ./std {};
parse = import ./parse {
attrs = std.attrs;
result = std.result;
};
in in
builtins.listToAttrs [
# submodule content is accessible first by submodule name
# then by the name of the content (ie self.submodule.myFunc)
{inherit parse;}
# submodule is included directly to this module (ie self.myFunc)
std std
// {
# this module
{
# === External Functions === # === External Functions ===
withPkgs = repo: config: system: withPkgs = repo: config: system:
import repo { import repo {
@ -10,17 +22,27 @@ in
} }
// config; // config;
mkSys = input: { mkSys = input: let
# function taking a system as argument
pkgsFor = input.pkgs;
in {
inherit pkgsFor;
forAllSystems = f: forAllSystems = f:
std.genAttrs systems ( std.genAttrs systems (
system: f system input.pkgs system: f system (pkgsFor system)
); );
}; };
mkUSys = input: { mkUSys = input: let
# functions taking a system as argument
pkgsFor = input.pkgs;
upkgsFor = input.upkgs;
in {
inherit pkgsFor upkgsFor;
forAllSystems = f: forAllSystems = f:
std.genAttrs systems ( std.genAttrs systems (
system: f system input.pkgs input.upkgs system: f system (pkgsFor system) (upkgsFor system)
); );
}; };
} }
]