nix-community.nixvim/wrappers/standalone.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.3 KiB
Nix
Raw Permalink Normal View History

{
self,
lib,
defaultSystem,
}:
{
# TODO: Deprecate this arg in favour of using module options
pkgs ? null,
# NOTE: `defaultSystem` is the only reason this function can't go in `<nixvim>.lib`
system ? defaultSystem,
extraSpecialArgs ? { },
_nixvimTests ? false,
module,
}:
let
2024-12-15 05:23:06 +00:00
# NOTE: we are importing this just for evalNixvim
helpers = self.lib.nixvim.override { inherit _nixvimTests; };
inherit (helpers.modules) evalNixvim;
systemMod =
if pkgs == null then
{
_file = ./standalone.nix;
nixpkgs.hostPlatform = lib.mkDefault { inherit system; };
}
else
{
_file = ./standalone.nix;
nixpkgs.pkgs = lib.mkDefault pkgs;
};
mkNvim =
mod:
let
2025-01-20 14:00:08 +00:00
modules = lib.toList mod;
nixvimConfig = evalNixvim {
2025-01-20 14:00:08 +00:00
modules = modules ++ [
systemMod
];
inherit extraSpecialArgs;
};
2025-01-20 14:00:08 +00:00
extend = extension: mkNvim (modules ++ lib.toList extension);
in
nixvimConfig.config.build.package.overrideAttrs (old: {
2025-01-20 14:00:08 +00:00
passthru = old.passthru or { } // {
inherit (nixvimConfig) config options;
2025-01-20 14:00:08 +00:00
inherit extend;
nixvimExtend = lib.warn "<nixvim>.nixvimExtend has been renamed to <nixvim>.extend" extend;
};
});
in
mkNvim module