add importOverlays
This commit is contained in:
parent
b2c23ad362
commit
37edddc2ee
1 changed files with 27 additions and 47 deletions
|
|
@ -54,8 +54,11 @@
|
||||||
Ensure `nexus.${path}` exists under your call to `cerulean.mkNexus`.
|
Ensure `nexus.${path}` exists under your call to `cerulean.mkNexus`.
|
||||||
'');
|
'');
|
||||||
in {
|
in {
|
||||||
groups = Terminal {};
|
|
||||||
overlays = [];
|
overlays = [];
|
||||||
|
extraModules = [];
|
||||||
|
specialArgs = Terminal {};
|
||||||
|
|
||||||
|
groups = Terminal {};
|
||||||
nodes = Terminal {};
|
nodes = Terminal {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -121,10 +124,19 @@
|
||||||
in
|
in
|
||||||
final;
|
final;
|
||||||
|
|
||||||
|
importOverlays = root: let
|
||||||
|
path = findImport (root + "/overlay");
|
||||||
|
in
|
||||||
|
if pathExists path
|
||||||
|
then import path
|
||||||
|
else [];
|
||||||
|
|
||||||
# XXX: TODO: create a function in NixTypes that handles this instead
|
# XXX: TODO: create a function in NixTypes that handles this instead
|
||||||
findImport = path:
|
findImport = path:
|
||||||
if pathExists path
|
if pathExists path
|
||||||
then path
|
then path
|
||||||
|
else if pathExists (path + "default.nix")
|
||||||
|
then path + "/default.nix"
|
||||||
else path + ".nix";
|
else path + ".nix";
|
||||||
in {
|
in {
|
||||||
mkNexus = root: outputsBuilder: let
|
mkNexus = root: outputsBuilder: let
|
||||||
|
|
@ -143,29 +155,6 @@ in {
|
||||||
system = node.system;
|
system = node.system;
|
||||||
modules = let
|
modules = let
|
||||||
host = findImport (root + "/hosts/${nodeName}");
|
host = findImport (root + "/hosts/${nodeName}");
|
||||||
# XXX: TODO: don't use a naive type for this (ie _name property)
|
|
||||||
# XXX: TODO: i really need NixTypes to be stable and use that instead
|
|
||||||
# groups =
|
|
||||||
# node.groups
|
|
||||||
# |> map (group:
|
|
||||||
# assert group ? _name
|
|
||||||
# || throw (let
|
|
||||||
# got =
|
|
||||||
# if ! isAttrs group
|
|
||||||
# then toString group
|
|
||||||
# else
|
|
||||||
# group
|
|
||||||
# |> attrNames
|
|
||||||
# |> map (name: "${name} = <${typeOf (getAttr name group)}>;")
|
|
||||||
# |> concatStringsSep " "
|
|
||||||
# |> (x: "{ ${x} }");
|
|
||||||
# in ''
|
|
||||||
# Cerulean Nexus node "${nodeName}" is a member of a nonexistent group.
|
|
||||||
# Got "${got}" of primitive type "${typeOf group}".
|
|
||||||
# NOTE: Groups can be accessed via `self.groups.PATH.TO.YOUR.GROUP`
|
|
||||||
# '');
|
|
||||||
# findImport (root + "/groups/${group._name}"))
|
|
||||||
# |> nt.prim.unique; # filter by uniqueness
|
|
||||||
groups = assert isList node.groups
|
groups = assert isList node.groups
|
||||||
|| throw ''
|
|| throw ''
|
||||||
Cerulean Nexus node "${nodeName}" does not declare group membership as a list, got "${typeOf node.groups}" instead!
|
Cerulean Nexus node "${nodeName}" does not declare group membership as a list, got "${typeOf node.groups}" instead!
|
||||||
|
|
@ -194,26 +183,10 @@ in {
|
||||||
'')
|
'')
|
||||||
# add all inherited groups via _parent
|
# add all inherited groups via _parent
|
||||||
|> map (let
|
|> map (let
|
||||||
delegate = g: let
|
delegate = g:
|
||||||
got =
|
if g._parent == null
|
||||||
if ! isAttrs g
|
then [g]
|
||||||
then toString g
|
else [g] ++ delegate (g._parent);
|
||||||
else
|
|
||||||
g
|
|
||||||
|> attrNames
|
|
||||||
|> map (name: "${name} = <${typeOf (getAttr name g)}>;")
|
|
||||||
|> concatStringsSep " "
|
|
||||||
|> (x: "{ ${x} }");
|
|
||||||
in
|
|
||||||
assert g ? _parent
|
|
||||||
|| throw ''
|
|
||||||
Cerulean Nexus node "${nodeName}" is a member of an incorrectly structured group.
|
|
||||||
Got "${got}" of primitive type "${typeOf g}".
|
|
||||||
NOTE: Groups can be accessed via `self.groups.PATH.TO.YOUR.GROUP`
|
|
||||||
'';
|
|
||||||
if g._parent == null
|
|
||||||
then [g]
|
|
||||||
else [g] ++ delegate (g._parent);
|
|
||||||
in
|
in
|
||||||
delegate)
|
delegate)
|
||||||
# flatten recursion result
|
# flatten recursion result
|
||||||
|
|
@ -225,7 +198,9 @@ in {
|
||||||
# ignore missing groups
|
# ignore missing groups
|
||||||
|> filter pathExists;
|
|> filter pathExists;
|
||||||
in
|
in
|
||||||
[../nixos-module host] ++ groups ++ node.extraModules;
|
[../nixos-module host]
|
||||||
|
++ groups
|
||||||
|
++ node.extraModules;
|
||||||
|
|
||||||
# nix passes these to every single module
|
# nix passes these to every single module
|
||||||
specialArgs = let
|
specialArgs = let
|
||||||
|
|
@ -234,8 +209,13 @@ in {
|
||||||
inherit (node) system;
|
inherit (node) system;
|
||||||
# XXX: WARNING: TODO: i've stopped caring
|
# XXX: WARNING: TODO: i've stopped caring
|
||||||
# XXX: WARNING: TODO: just figure out a better solution to pkgConfig
|
# XXX: WARNING: TODO: just figure out a better solution to pkgConfig
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = false;
|
||||||
overlays = self.overlays ++ nexus.overlays ++ node.overlays;
|
config.allowBroken = false;
|
||||||
|
overlays =
|
||||||
|
self.overlays
|
||||||
|
++ nexus.overlays
|
||||||
|
++ node.overlays
|
||||||
|
++ importOverlays root;
|
||||||
}
|
}
|
||||||
// node.extraPkgConfig;
|
// node.extraPkgConfig;
|
||||||
in
|
in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue