lib: move clan out of lib into flake
This allows clanLib to stay agnostic and be more testable
This commit is contained in:
52
lib/clan/default.nix
Normal file
52
lib/clan/default.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
## WARNING: Do not add core logic here.
|
||||
## This is only a wrapper such that 'clan' can be called as a function.
|
||||
{
|
||||
lib,
|
||||
clan-core,
|
||||
}:
|
||||
/**
|
||||
Function that takes clan options as function arguments.
|
||||
|
||||
It behaves equivalent to:
|
||||
|
||||
```nix
|
||||
{
|
||||
imports = [
|
||||
clan-core.modules.clan.default
|
||||
args
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
- self: Reference to the current flake. This is required be passed.
|
||||
- ...: All other arguments - Which are options as of the 'clan.*' module
|
||||
|
||||
Returns:
|
||||
The clan configuration.
|
||||
*/
|
||||
{
|
||||
self ? lib.warn "Argument: 'self' must be set" null, # Reference to the current flake
|
||||
...
|
||||
}@m:
|
||||
let
|
||||
nixpkgs = self.inputs.nixpkgs or clan-core.inputs.nixpkgs;
|
||||
nix-darwin = self.inputs.nix-darwin or clan-core.inputs.nix-darwin;
|
||||
in
|
||||
lib.evalModules {
|
||||
class = "clan";
|
||||
specialArgs = {
|
||||
inherit
|
||||
self
|
||||
;
|
||||
inherit
|
||||
nixpkgs
|
||||
nix-darwin
|
||||
;
|
||||
};
|
||||
modules = [
|
||||
clan-core.modules.clan.default
|
||||
m
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user