nix-community.nixvim/lib/modules.nix
Matt Sturgeon 4b7a41276a
modules/nixpkgs: initial pkgs option, drop defaultPkgs specialArg
This minimal implementation allows `nixpkgs.pkgs` to be defined, but
does not implement evaluating an instance from a pkgsPath when _not_
defined.

The `defaultPkgs` specialArg is dropped in favour of `nixpkgs.pkgs`
being defined. If it's not defined, an assertion is thrown.

In the future, a nixpkgs source path can be supplied, defaulting to the
flake's `inputs.nixpkgs`. Along with other `nixpkgs.*` options, this
will allow a `pkgs` instance to be evaluated within the module eval.
2024-09-27 09:30:12 +01:00

37 lines
1.1 KiB
Nix

{
lib,
self,
}:
rec {
# Minimal specialArgs required to evaluate nixvim modules
specialArgs = specialArgsWith { };
# Build specialArgs for evaluating nixvim modules
specialArgsWith =
extraSpecialArgs:
{
inherit lib;
# TODO: deprecate `helpers`
helpers = self;
}
// extraSpecialArgs;
# Evaluate nixvim modules, checking warnings and assertions
evalNixvim =
{
modules ? [ ],
extraSpecialArgs ? { },
check ? null, # TODO: Remove stub
}@args:
# TODO: `check` argument removed 2024-09-24
# NOTE: this argument was always marked as experimental
assert lib.assertMsg (!args ? "check")
"`evalNixvim`: passing `check` is no longer supported. Checks are now done when evaluating `config.build.package` and can be avoided by using `config.build.packageUnchecked` instead.";
lib.evalModules {
modules = [ ../modules/top-level ] ++ modules;
specialArgs = specialArgsWith extraSpecialArgs;
};
# TODO: Removed 2024-09-24
getAssertionMessages = throw "`modules.getAssertionMessages` has been removed.";
}