Files
nixvim/flake/wrappers.nix
Matt SturgeonandMrQubo 56f95d1655 wrappers: fix _module.check disablement
When passing a string to `disabledModules`, it is appended to
`modulesPath`. To avoid this, explicitly pass a `{key}` module.

Adds an assertion module to the platform-wrapper integration tests:

    Failed assertions:
       - Expected programs.nixvim._module.check to be true. Definitions:
       - In `/nix/store/XXXX-source/flake/wrappers.nix': false

Co-authored-by: MrQubo <jakub.jakub.nowak@gmail.com>
2026-06-13 19:20:02 +00:00

63 lines
1.8 KiB
Nix

{
self,
lib,
...
}:
let
# Added 2025-05-25; warning shown since 2025-08-01 (25.11)
# NOTE: top-level binding of a fully resolved value, to avoid printing multiple times
homeManagerModulesWarning = lib.warn "nixvim: flake output `homeManagerModules` has been renamed to `homeModules`." null;
# A base configuration used to evaluate the wrapper modules.
#
# While we don't define a `pkgs` or `hostPlatform` here, which would normally
# lead to eval errors, disabling option-declaration checking gives us enough
# laziness to evaluate the options we need.
#
# The `_module.check` module has a key, so we can disable it later in the
# platform wrapper modules.
configuration = self.lib.evalNixvim {
modules = [
{
_file = __curPos.file;
key = "<internal:nixvim-nocheck-base-eval>";
config._module.check = false;
}
];
};
in
{
perSystem =
{ config, system, ... }:
let
inherit (config.legacyPackages) makeNixvimWithModule;
in
{
legacyPackages = {
makeNixvimWithModule = import ../wrappers/standalone.nix {
inherit lib;
inherit (self.lib) evalNixvim;
defaultSystem = system;
};
makeNixvim = module: makeNixvimWithModule { inherit module; };
};
};
flake = {
nixosModules = {
nixvim = configuration.config.build.nixosModule;
default = self.nixosModules.nixvim;
};
# Alias for backward compatibility
homeManagerModules = lib.mapAttrs (_: lib.seq homeManagerModulesWarning) self.homeModules;
homeModules = {
nixvim = configuration.config.build.homeModule;
default = self.homeModules.nixvim;
};
nixDarwinModules = {
nixvim = configuration.config.build.nixDarwinModule;
default = self.nixDarwinModules.nixvim;
};
};
}