module: sys.nix
This commit is contained in:
parent
f57e6f47d0
commit
452dcf99bb
2 changed files with 41 additions and 35 deletions
|
|
@ -1,52 +1,21 @@
|
|||
{systems, ...}: let
|
||||
# TODO: move this to a new module
|
||||
mkMod' = args: mod: import mod args;
|
||||
mkMod = mkMod' {inherit nib;};
|
||||
mkMod = mkMod' {inherit systems nib;};
|
||||
|
||||
std = mkMod ./std;
|
||||
types = mkMod ./types;
|
||||
parse = mkMod ./parse;
|
||||
panic = mkMod ./panic.nix;
|
||||
sys = mkMod ./sys.nix;
|
||||
|
||||
nib = std.mergeAttrsList [
|
||||
# submodule content is accessible first by submodule name
|
||||
# then by the name of the content (ie self.submodule.myFunc)
|
||||
{inherit std types panic parse;}
|
||||
|
||||
# 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.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)
|
||||
);
|
||||
};
|
||||
}
|
||||
# submodule content accessible directly (ie self.myFunc)
|
||||
sys
|
||||
];
|
||||
in
|
||||
nib
|
||||
|
|
|
|||
37
nib/sys.nix
Normal file
37
nib/sys.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
systems,
|
||||
nib,
|
||||
...
|
||||
}: let
|
||||
std = nib.std;
|
||||
in {
|
||||
# === 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.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