mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
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.
53 lines
1.3 KiB
Nix
53 lines
1.3 KiB
Nix
default_pkgs: self:
|
|
{
|
|
# TODO: Deprecate this arg in favour of using module options
|
|
pkgs ? default_pkgs,
|
|
lib ? pkgs.lib,
|
|
extraSpecialArgs ? { },
|
|
_nixvimTests ? false,
|
|
module,
|
|
}:
|
|
let
|
|
# NOTE: user-facing so we must include the legacy `pkgs` argument
|
|
helpers = import ../lib { inherit pkgs lib _nixvimTests; };
|
|
|
|
inherit (helpers.modules) evalNixvim;
|
|
|
|
mkNvim =
|
|
mod:
|
|
let
|
|
nixvimConfig = evalNixvim {
|
|
modules = [
|
|
mod
|
|
# TODO: only include this when `args?pkgs`:
|
|
{
|
|
_file = ./standalone.nix;
|
|
nixpkgs.pkgs = lib.mkDefault pkgs;
|
|
}
|
|
];
|
|
inherit extraSpecialArgs;
|
|
};
|
|
inherit (nixvimConfig.config) enableMan build;
|
|
in
|
|
(pkgs.symlinkJoin {
|
|
name = "nixvim";
|
|
paths = [
|
|
build.package
|
|
build.printInitPackage
|
|
] ++ pkgs.lib.optional enableMan self.packages.${pkgs.stdenv.hostPlatform.system}.man-docs;
|
|
meta.mainProgram = "nvim";
|
|
})
|
|
// rec {
|
|
inherit (nixvimConfig) config options;
|
|
extend =
|
|
extension:
|
|
mkNvim {
|
|
imports = [
|
|
mod
|
|
extension
|
|
];
|
|
};
|
|
nixvimExtend = lib.warn "<nixvim>.nixvimExtend has been renamed to <nixvim>.extend" extend;
|
|
};
|
|
in
|
|
mkNvim module
|