modules/top-level: move out of wrappers/modules

This commit is contained in:
Matt Sturgeon 2024-07-05 14:25:21 +01:00
parent b59fa976d0
commit 2deb61f6a5
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
10 changed files with 34 additions and 16 deletions

View file

@ -63,9 +63,11 @@ let
# Evaluation is irrelevant, only used for documentation.
};
# Construct our own top-level modules, because we want to stub the `files` option
# FIXME: add a way to handle this with specialArgs
topLevelModules = [
../modules
../wrappers/modules/output.nix
../modules/top-level/output.nix
# Fake module to avoid a duplicated documentation
(lib.setDefaultModuleLocation "${nixvimPath}/wrappers/modules/files.nix" {
options.files = lib.mkOption {

View file

@ -1,3 +1,7 @@
# This module includes the nixvim modules that should always be evaluated.
#
# You may want to use the `/modules/top-level` module instead, unless you're
# using this in a submodule nested within another nixvim config.
{
imports = [
./misc

View file

@ -0,0 +1,12 @@
# Alternative to `/modules` that also includes modules that should only exist at the "top-level".
# Therefore, `/modules` should be used instead for submodules nested within a nixvim config.
#
# When using this, you likely also want a "wrapper" module for any platform-specific options.
# See `/wrappers/modules` for examples.
{
imports = [
../.
./files.nix
./output.nix
];
}

View file

@ -17,7 +17,7 @@ let
(
{ name, config, ... }:
{
imports = [ ../../modules ];
imports = [ ../. ];
options.plugin = lib.mkOption {
type = types.package;
description = "A derivation with the content of the file in it";

View file

@ -5,12 +5,6 @@ let
cfg = config.programs.nixvim;
in
{
topLevelModules = [
../modules
./modules/output.nix
./modules/files.nix
];
helpers = mkOption {
type = mkOptionType {
name = "helpers";

View file

@ -30,7 +30,10 @@ in
defaultPkgs = pkgs;
inherit helpers;
};
modules = [ ./modules/darwin.nix ] ++ shared.topLevelModules;
modules = [
./modules/darwin.nix
../modules/top-level
];
};
};
nixvim.helpers = shared.helpers;

View file

@ -32,7 +32,10 @@ in
defaultPkgs = pkgs;
inherit helpers;
};
modules = [ ./modules/hm.nix ] ++ shared.topLevelModules;
modules = [
./modules/hm.nix
../modules/top-level
];
};
};
nixvim.helpers = shared.helpers;

View file

@ -33,7 +33,10 @@ in
defaultPkgs = pkgs;
inherit helpers;
};
modules = [ ./modules/nixos.nix ] ++ shared.topLevelModules;
modules = [
./modules/nixos.nix
../modules/top-level
];
};
};
nixvim.helpers = shared.helpers;

View file

@ -10,10 +10,6 @@ let
inherit (pkgs) lib;
helpers = getHelpers pkgs _nixvimTests;
shared = import ./_shared.nix helpers {
inherit pkgs lib;
config = { };
};
handleAssertions =
config:
@ -32,7 +28,8 @@ let
modules = [
mod
{ wrapRc = true; }
] ++ shared.topLevelModules;
../modules/top-level
];
specialArgs = {
inherit helpers;
defaultPkgs = pkgs;