diff --git a/lib/build-clan/default.nix b/lib/build-clan/default.nix index 3089cc2aa..5c6eeb502 100644 --- a/lib/build-clan/default.nix +++ b/lib/build-clan/default.nix @@ -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. diff --git a/lib/build-clan/interface.nix b/lib/build-clan/interface.nix index a264bfd95..6cada08dd 100644 --- a/lib/build-clan/interface.nix +++ b/lib/build-clan/interface.nix @@ -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 = ''