refactor: clanLib buildClan
This commit is contained in:
@@ -9,7 +9,7 @@ clan-core:
|
|||||||
let
|
let
|
||||||
inherit (lib) types;
|
inherit (lib) types;
|
||||||
|
|
||||||
buildClanModule = clan-core.clanLib.buildClanModule;
|
clanLib = clan-core.clanLib;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -40,7 +40,7 @@ in
|
|||||||
# inventoryInterface = {};
|
# inventoryInterface = {};
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
buildClanModule.flakePartsModule
|
clanLib.module
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ in
|
|||||||
self = throw "set clan.directory in the test";
|
self = throw "set clan.directory in the test";
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
clanLib.buildClanModule.flakePartsModule
|
clanLib.module
|
||||||
{
|
{
|
||||||
_prefix = [
|
_prefix = [
|
||||||
"checks"
|
"checks"
|
||||||
|
|||||||
@@ -8,40 +8,58 @@
|
|||||||
# Produces the
|
# Produces the
|
||||||
# 'clanLib' attribute set
|
# 'clanLib' attribute set
|
||||||
# Wrapped with fix, so we can depend on other clanLib functions without passing the whole flake
|
# Wrapped with fix, so we can depend on other clanLib functions without passing the whole flake
|
||||||
lib.fix (clanLib: {
|
lib.fix (
|
||||||
/**
|
clanLib:
|
||||||
Like callPackage, but doesn't try to automatically detect arguments
|
let
|
||||||
'lib' and 'clanLib' are always passed, plus the additional arguments
|
buildClanLib = (
|
||||||
*/
|
clanLib.callLib ./modules {
|
||||||
callLib = file: args: import file ({ inherit lib clanLib; } // args);
|
clan-core = self;
|
||||||
|
inherit nixpkgs nix-darwin;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
module = {
|
||||||
|
_class = "clan";
|
||||||
|
_module.args = {
|
||||||
|
inherit clanLib;
|
||||||
|
};
|
||||||
|
imports = [
|
||||||
|
./modules/clan/default.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# ------------------------------------
|
inherit (buildClanLib)
|
||||||
buildClan = clanLib.buildClanModule.buildClanWith {
|
buildClan
|
||||||
clan-core = self;
|
;
|
||||||
inherit nixpkgs nix-darwin;
|
/**
|
||||||
};
|
Like callPackage, but doesn't try to automatically detect arguments
|
||||||
evalService = clanLib.callLib ./modules/inventory/distributed-service/evalService.nix { };
|
'lib' and 'clanLib' are always passed, plus the additional arguments
|
||||||
# ------------------------------------
|
*/
|
||||||
# ClanLib functions
|
callLib = file: args: import file ({ inherit lib clanLib; } // args);
|
||||||
evalClan = clanLib.callLib ./modules/inventory/eval-clan-modules { };
|
|
||||||
buildClanModule = clanLib.callLib ./modules { };
|
|
||||||
inventory = clanLib.callLib ./modules/inventory { };
|
|
||||||
modules = clanLib.callLib ./modules/inventory/frontmatter { };
|
|
||||||
test = clanLib.callLib ./test { };
|
|
||||||
# Custom types
|
|
||||||
types = clanLib.callLib ./types { };
|
|
||||||
|
|
||||||
# Plain imports.
|
evalService = clanLib.callLib ./modules/inventory/distributed-service/evalService.nix { };
|
||||||
introspection = import ./introspection { inherit lib; };
|
# ------------------------------------
|
||||||
jsonschema = import ./jsonschema { inherit lib; };
|
# ClanLib functions
|
||||||
facts = import ./facts.nix { inherit lib; };
|
evalClan = clanLib.callLib ./modules/inventory/eval-clan-modules { };
|
||||||
|
inventory = clanLib.callLib ./modules/inventory { };
|
||||||
|
modules = clanLib.callLib ./modules/inventory/frontmatter { };
|
||||||
|
test = clanLib.callLib ./test { };
|
||||||
|
# Custom types
|
||||||
|
types = clanLib.callLib ./types { };
|
||||||
|
|
||||||
# flakes
|
# Plain imports.
|
||||||
flakes = clanLib.callLib ./flakes.nix {
|
introspection = import ./introspection { inherit lib; };
|
||||||
clan-core = self;
|
jsonschema = import ./jsonschema { inherit lib; };
|
||||||
};
|
facts = import ./facts.nix { inherit lib; };
|
||||||
|
|
||||||
# deprecated
|
# flakes
|
||||||
# remove when https://git.clan.lol/clan/clan-core/pulls/3212 is implemented
|
flakes = clanLib.callLib ./flakes.nix {
|
||||||
inherit (self.inputs.nix-select.lib) select;
|
clan-core = self;
|
||||||
})
|
};
|
||||||
|
|
||||||
|
# deprecated
|
||||||
|
# remove when https://git.clan.lol/clan/clan-core/pulls/3212 is implemented
|
||||||
|
inherit (self.inputs.nix-select.lib) select;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
@@ -4,19 +4,19 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
clanLib,
|
clanLib,
|
||||||
...
|
clan-core,
|
||||||
|
nixpkgs,
|
||||||
|
nix-darwin,
|
||||||
}:
|
}:
|
||||||
rec {
|
rec {
|
||||||
# TODO: rename to clanModule
|
# ------------------------------------
|
||||||
flakePartsModule = {
|
buildClan = buildClanWith {
|
||||||
_module.args = {
|
inherit
|
||||||
inherit clanLib;
|
clan-core
|
||||||
};
|
nixpkgs
|
||||||
imports = [
|
nix-darwin
|
||||||
./clan/default.nix
|
;
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A function that takes some arguments such as 'clan-core' and returns the 'buildClan' function.
|
A function that takes some arguments such as 'clan-core' and returns the 'buildClan' function.
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ rec {
|
|||||||
modules = [
|
modules = [
|
||||||
# buildClan arguments are equivalent to specifying a module
|
# buildClan arguments are equivalent to specifying a module
|
||||||
m
|
m
|
||||||
flakePartsModule
|
clanLib.module
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ let
|
|||||||
# @enzime why do we need this here?
|
# @enzime why do we need this here?
|
||||||
class = "nixos";
|
class = "nixos";
|
||||||
modules = [
|
modules = [
|
||||||
clanLib.buildClanModule.flakePartsModule
|
clanLib.module
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
evalDocs = pkgs.nixosOptionsDoc {
|
evalDocs = pkgs.nixosOptionsDoc {
|
||||||
|
|||||||
Reference in New Issue
Block a user