mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-03 01:25:22 +02:00
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.
This commit is contained in:
parent
8c3d521bff
commit
4b7a41276a
11 changed files with 111 additions and 43 deletions
|
@ -38,24 +38,12 @@ lib.fix (
|
|||
extendedLib = call ./extend-lib.nix { inherit lib; };
|
||||
keymaps = call ./keymap-helpers.nix { };
|
||||
lua = call ./to-lua.nix { };
|
||||
modules = call ./modules.nix { };
|
||||
neovim-plugin = call ./neovim-plugin.nix { };
|
||||
options = call ./options.nix { };
|
||||
utils = call ./utils.nix { inherit _nixvimTests; };
|
||||
vim-plugin = call ./vim-plugin.nix { };
|
||||
|
||||
# Handle modules, which currently requires a `defaultPkgs` specialArg
|
||||
# FIXME: our minimal specialArgs should not need `pkgs`
|
||||
modules = call ./modules.nix { } // {
|
||||
# Minimal specialArgs required to evaluate nixvim modules
|
||||
specialArgs = self.modules.specialArgsWith {
|
||||
defaultPkgs =
|
||||
if pkgs == null then
|
||||
throw "`modules.specialArgs` cannot currently be used when nixvim's lib is built without a `pkgs` instance. This will be resolved in the future."
|
||||
else
|
||||
pkgs;
|
||||
};
|
||||
};
|
||||
|
||||
# Handle builders, which has some deprecated stuff that depends on `pkgs`
|
||||
builders = builders // deprecatedBuilders;
|
||||
inherit (self.builders)
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
self,
|
||||
}:
|
||||
rec {
|
||||
# Minimal specialArgs required to evaluate nixvim modules
|
||||
specialArgs = specialArgsWith { };
|
||||
|
||||
# Build specialArgs for evaluating nixvim modules
|
||||
specialArgsWith =
|
||||
# TODO: switch defaultPkgs -> pkgsPath (i.e. pkgs.path or inputs.nixvim)
|
||||
# FIXME: Ideally, we should not require callers to pass in _anything_ specific
|
||||
{ defaultPkgs, ... }@extraSpecialArgs:
|
||||
extraSpecialArgs:
|
||||
{
|
||||
inherit lib defaultPkgs;
|
||||
inherit lib;
|
||||
# TODO: deprecate `helpers`
|
||||
helpers = self;
|
||||
}
|
||||
|
|
|
@ -62,10 +62,11 @@ let
|
|||
{ config.test.runNvim = !dontRun; }
|
||||
))
|
||||
{ wrapRc = true; }
|
||||
# TODO: Only do this when `args?pkgs`
|
||||
# Consider deprecating the `pkgs` arg too...
|
||||
{ nixpkgs.pkgs = lib.mkDefault pkgs; }
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
defaultPkgs = pkgs;
|
||||
} // extraSpecialArgs;
|
||||
inherit extraSpecialArgs;
|
||||
};
|
||||
in
|
||||
result.config.build.test;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue