restructure std -> nib.types + change type naming convention
This commit is contained in:
parent
b9f2acf7e7
commit
eac4161b36
11 changed files with 129 additions and 139 deletions
101
nib/default.nix
101
nib/default.nix
|
|
@ -1,54 +1,55 @@
|
|||
{systems, ...}: let
|
||||
mergeAttrsList = std.attrs.mergeAttrsList;
|
||||
mergeAttrsList = types.mergeAttrsList;
|
||||
|
||||
std = import ./std {};
|
||||
stdSubMods = {
|
||||
attrs = std.attrs;
|
||||
fault = std.fault;
|
||||
lists = std.lists;
|
||||
result = std.result;
|
||||
};
|
||||
submodArgs = {inherit nib;};
|
||||
|
||||
parse = import ./parse (mergeAttrsList [stdSubMods]);
|
||||
# TODO: move this to a new module
|
||||
mkMod' = args: mod: import mod args;
|
||||
mkMod = mkMod' submodArgs;
|
||||
|
||||
parse = mkMod ./parse;
|
||||
types = mkMod ./types;
|
||||
|
||||
nib = with types;
|
||||
mergeAttrsList [
|
||||
# submodule content is accessible first by submodule name
|
||||
# then by the name of the content (ie self.submodule.myFunc)
|
||||
{inherit parse types;}
|
||||
|
||||
# submodule is included directly to this module (ie self.myFunc)
|
||||
|
||||
# this module
|
||||
{
|
||||
# === External Functions ===
|
||||
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.attrs.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.attrs.genAttrs systems (
|
||||
system: f system (pkgsFor system) (upkgsFor system)
|
||||
);
|
||||
};
|
||||
}
|
||||
];
|
||||
in
|
||||
mergeAttrsList [
|
||||
# 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
|
||||
|
||||
# this module
|
||||
{
|
||||
# === External Functions ===
|
||||
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.attrs.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.attrs.genAttrs systems (
|
||||
system: f system (pkgsFor system) (upkgsFor system)
|
||||
);
|
||||
};
|
||||
}
|
||||
]
|
||||
nib
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue