1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-21 17:59:41 +01:00
nixvim/wrappers/standalone.nix
Matt Sturgeon 8d0ca9abc4 lib: move enableExceptInTests impl to build.test option
Simplify the `enableExceptInTests` attribute, removing the
`_nixvimTests` argument.

We now do a full re-eval of the nixvim configuration before building the
test, giving us a central place to implement `enableExceptInTests` and
its eventual replacement(s).

This extends support for `enableExceptInTests` to all methods of getting
a nixvim test derivation. Previously, it only worked when using `mkTestDerivationFromNixvimModule`.

In `tests/main.nix`, we avoid the re-eval by doing the initial eval with
a "test mode" lib from the start.
2025-11-20 00:22:57 +00:00

48 lines
1.1 KiB
Nix

{
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 ? { },
module,
}:
let
# NOTE: we are importing this just for 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
modules = lib.toList mod;
nixvimConfig = self.lib.evalNixvim {
modules = modules ++ [
systemMod
];
inherit extraSpecialArgs;
};
extend = extension: mkNvim (modules ++ lib.toList extension);
in
nixvimConfig.config.build.package.overrideAttrs (old: {
passthru = old.passthru or { } // {
inherit (nixvimConfig) config options;
inherit extend;
nixvimExtend = lib.warn "<nixvim>.nixvimExtend has been renamed to <nixvim>.extend" extend;
};
});
in
mkNvim module