Merge pull request 'chore: buildClan warn access without .config prefix' (#4108) from hsjobeki/buildClan into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4108
This commit is contained in:
@@ -9,7 +9,7 @@ clan-core:
|
||||
let
|
||||
inherit (lib) types;
|
||||
|
||||
buildClanModule = clan-core.clanLib.buildClanModule;
|
||||
clanLib = clan-core.clanLib;
|
||||
|
||||
in
|
||||
{
|
||||
@@ -40,7 +40,7 @@ in
|
||||
# inventoryInterface = {};
|
||||
};
|
||||
modules = [
|
||||
buildClanModule.flakePartsModule
|
||||
clanLib.module
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -197,7 +197,7 @@ in
|
||||
self = throw "set clan.directory in the test";
|
||||
};
|
||||
modules = [
|
||||
clanLib.buildClanModule.flakePartsModule
|
||||
clanLib.module
|
||||
{
|
||||
_prefix = [
|
||||
"checks"
|
||||
|
||||
@@ -8,40 +8,58 @@
|
||||
# Produces the
|
||||
# 'clanLib' attribute set
|
||||
# Wrapped with fix, so we can depend on other clanLib functions without passing the whole flake
|
||||
lib.fix (clanLib: {
|
||||
/**
|
||||
Like callPackage, but doesn't try to automatically detect arguments
|
||||
'lib' and 'clanLib' are always passed, plus the additional arguments
|
||||
*/
|
||||
callLib = file: args: import file ({ inherit lib clanLib; } // args);
|
||||
lib.fix (
|
||||
clanLib:
|
||||
let
|
||||
buildClanLib = (
|
||||
clanLib.callLib ./modules {
|
||||
clan-core = self;
|
||||
inherit nixpkgs nix-darwin;
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
module = {
|
||||
_class = "clan";
|
||||
_module.args = {
|
||||
inherit clanLib;
|
||||
};
|
||||
imports = [
|
||||
./modules/clan/default.nix
|
||||
];
|
||||
};
|
||||
|
||||
# ------------------------------------
|
||||
buildClan = clanLib.buildClanModule.buildClanWith {
|
||||
clan-core = self;
|
||||
inherit nixpkgs nix-darwin;
|
||||
};
|
||||
evalService = clanLib.callLib ./modules/inventory/distributed-service/evalService.nix { };
|
||||
# ------------------------------------
|
||||
# ClanLib functions
|
||||
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 { };
|
||||
inherit (buildClanLib)
|
||||
buildClan
|
||||
;
|
||||
/**
|
||||
Like callPackage, but doesn't try to automatically detect arguments
|
||||
'lib' and 'clanLib' are always passed, plus the additional arguments
|
||||
*/
|
||||
callLib = file: args: import file ({ inherit lib clanLib; } // args);
|
||||
|
||||
# Plain imports.
|
||||
introspection = import ./introspection { inherit lib; };
|
||||
jsonschema = import ./jsonschema { inherit lib; };
|
||||
facts = import ./facts.nix { inherit lib; };
|
||||
evalService = clanLib.callLib ./modules/inventory/distributed-service/evalService.nix { };
|
||||
# ------------------------------------
|
||||
# ClanLib functions
|
||||
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
|
||||
flakes = clanLib.callLib ./flakes.nix {
|
||||
clan-core = self;
|
||||
};
|
||||
# Plain imports.
|
||||
introspection = import ./introspection { inherit lib; };
|
||||
jsonschema = import ./jsonschema { inherit lib; };
|
||||
facts = import ./facts.nix { inherit lib; };
|
||||
|
||||
# deprecated
|
||||
# remove when https://git.clan.lol/clan/clan-core/pulls/3212 is implemented
|
||||
inherit (self.inputs.nix-select.lib) select;
|
||||
})
|
||||
# flakes
|
||||
flakes = clanLib.callLib ./flakes.nix {
|
||||
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,
|
||||
clanLib,
|
||||
...
|
||||
clan-core,
|
||||
nixpkgs,
|
||||
nix-darwin,
|
||||
}:
|
||||
rec {
|
||||
# TODO: rename to clanModule
|
||||
flakePartsModule = {
|
||||
_module.args = {
|
||||
inherit clanLib;
|
||||
};
|
||||
imports = [
|
||||
./clan/default.nix
|
||||
];
|
||||
# ------------------------------------
|
||||
buildClan = buildClanWith {
|
||||
inherit
|
||||
clan-core
|
||||
nixpkgs
|
||||
nix-darwin
|
||||
;
|
||||
};
|
||||
|
||||
/**
|
||||
A function that takes some arguments such as 'clan-core' and returns the 'buildClan' function.
|
||||
|
||||
@@ -61,9 +61,13 @@ rec {
|
||||
modules = [
|
||||
# buildClan arguments are equivalent to specifying a module
|
||||
m
|
||||
flakePartsModule
|
||||
clanLib.module
|
||||
];
|
||||
};
|
||||
in
|
||||
result.config;
|
||||
# Remove result.config in 26. July
|
||||
result
|
||||
// (lib.mapAttrs (
|
||||
n: v: lib.warn "buildClan output: Use 'config.${n}' instead of '${n}'" v
|
||||
) result.config);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,8 @@
|
||||
}:
|
||||
let
|
||||
eval = lib.evalModules {
|
||||
# TODO: Move this into a 'classForMachines' or something
|
||||
# @enzime why do we need this here?
|
||||
class = "nixos";
|
||||
modules = [
|
||||
clanLib.buildClanModule.flakePartsModule
|
||||
clanLib.module
|
||||
];
|
||||
};
|
||||
evalDocs = pkgs.nixosOptionsDoc {
|
||||
|
||||
Reference in New Issue
Block a user