fix: root module use module design pattern
This commit is contained in:
parent
3d9e9740d2
commit
6a00621981
1 changed files with 44 additions and 22 deletions
|
|
@ -1,26 +1,48 @@
|
||||||
{systems, ...}: let
|
{systems, ...}: let
|
||||||
std = import ./std;
|
std = import ./std {};
|
||||||
|
parse = import ./parse {
|
||||||
|
attrs = std.attrs;
|
||||||
|
result = std.result;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
std
|
builtins.listToAttrs [
|
||||||
// {
|
# submodule content is accessible first by submodule name
|
||||||
# === External Functions ===
|
# then by the name of the content (ie self.submodule.myFunc)
|
||||||
withPkgs = repo: config: system:
|
{inherit parse;}
|
||||||
import repo {
|
|
||||||
inherit system;
|
|
||||||
}
|
|
||||||
// config;
|
|
||||||
|
|
||||||
mkSys = input: {
|
# submodule is included directly to this module (ie self.myFunc)
|
||||||
forAllSystems = f:
|
std
|
||||||
std.genAttrs systems (
|
|
||||||
system: f system input.pkgs
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
mkUSys = input: {
|
# this module
|
||||||
forAllSystems = f:
|
{
|
||||||
std.genAttrs systems (
|
# === External Functions ===
|
||||||
system: f system input.pkgs input.upkgs
|
withPkgs = repo: config: system:
|
||||||
);
|
import repo {
|
||||||
};
|
inherit system;
|
||||||
}
|
}
|
||||||
|
// config;
|
||||||
|
|
||||||
|
mkSys = input: let
|
||||||
|
# function taking a system as argument
|
||||||
|
pkgsFor = input.pkgs;
|
||||||
|
in {
|
||||||
|
inherit pkgsFor;
|
||||||
|
forAllSystems = f:
|
||||||
|
std.genAttrs systems (
|
||||||
|
system: f system (pkgsFor system)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
mkUSys = input: let
|
||||||
|
# functions taking a system as argument
|
||||||
|
pkgsFor = input.pkgs;
|
||||||
|
upkgsFor = input.upkgs;
|
||||||
|
in {
|
||||||
|
inherit pkgsFor upkgsFor;
|
||||||
|
forAllSystems = f:
|
||||||
|
std.genAttrs systems (
|
||||||
|
system: f system (pkgsFor system) (upkgsFor system)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue