buildClan: add depercation warnings for directory=self

This commit is contained in:
Johannes Kirschbauer
2025-02-03 09:48:21 +01:00
parent 6f1ab30881
commit 2341b0e673
2 changed files with 11 additions and 4 deletions

View File

@@ -8,7 +8,7 @@
}:
{
## Inputs
self ? null, # Reference to the current flake
self ? lib.warn "Argument: 'self' must be set when using 'buildClan'." null, # Reference to the current flake
# allows to include machine-specific modules i.e. machines.${name} = { ... }
# A map from arch to pkgs, if specified this nixpkgs will be only imported once for each system.
# This improves performance, but all nipxkgs.* options will be ignored.

View File

@@ -9,9 +9,8 @@ in
{
options = {
self = lib.mkOption {
type = types.nullOr types.raw;
type = types.raw;
default = self;
readOnly = true;
defaultText = "Reference to the current flake";
description = ''
This is used to import external clan modules.
@@ -19,7 +18,15 @@ in
};
directory = lib.mkOption {
type = types.path;
type = types.coercedTo lib.types.raw (
v:
if lib.isAttrs v then
lib.warn "It appears you set 'clan.directory = self'. Instead set 'clan.self = self'. 'clan.directory' expects a path" v
else if v == null then
throw "Please set either clan.self or clan.directory"
else
builtins.toString v
) lib.types.path;
default = builtins.toString self;
defaultText = "Root directory of the flake";
description = ''