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>
This commit is contained in:
Matt Sturgeon 2026-06-13 20:05:18 +01:00
parent 19a4e5efa1
commit 56f95d1655
6 changed files with 25 additions and 1 deletions

View file

@ -19,6 +19,7 @@ let
configuration = self.lib.evalNixvim {
modules = [
{
_file = __curPos.file;
key = "<internal:nixvim-nocheck-base-eval>";
config._module.check = false;
}

View file

@ -9,6 +9,9 @@ self.inputs.nix-darwin.lib.darwinSystem {
programs.nixvim = {
enable = true;
imports = [
./module-check-enabled.nix
];
};
system.stateVersion = 5;

View file

@ -14,6 +14,9 @@ self.inputs.home-manager.lib.homeManagerConfiguration {
programs.nixvim = {
enable = true;
imports = [
./module-check-enabled.nix
];
};
programs.home-manager.enable = true;

View file

@ -0,0 +1,14 @@
{
lib,
config,
options,
...
}:
{
assertions = [
{
assertion = config._module.check;
message = "Expected ${options._module.check} to be true. Definitions:${lib.options.showDefs options._module.check.definitionsWithLocations}";
}
];
}

View file

@ -16,6 +16,9 @@ self.inputs.nixpkgs.lib.nixosSystem {
programs.nixvim = {
enable = true;
imports = [
./module-check-enabled.nix
];
};
}
self.nixosModules.nixvim

View file

@ -52,7 +52,7 @@ let
baseConfiguration = extendModules {
modules = [
nixpkgsModule
{ disabledModules = [ "<internal:nixvim-nocheck-base-eval>" ]; }
{ disabledModules = [ { key = "<internal:nixvim-nocheck-base-eval>"; } ]; }
];
};