Skip to content

Use homeModules as flake output name for Home Manager modules #3387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ in
{
imports = [
# For home-manager
nixvim.homeManagerModules.nixvim
nixvim.homeModules.nixvim
# For NixOS
nixvim.nixosModules.nixvim
# For nix-darwin
Expand Down Expand Up @@ -158,7 +158,7 @@ flakes, just add the nixvim input:
}
```

You can now access the module using `inputs.nixvim.homeManagerModules.nixvim`,
You can now access the module using `inputs.nixvim.homeModules.nixvim`,
for a home-manager installation, `inputs.nixvim.nixosModules.nixvim`, for NixOS,
and `inputs.nixvim.nixDarwinModules.nixvim` for nix-darwin.

Expand All @@ -167,7 +167,7 @@ and `inputs.nixvim.nixDarwinModules.nixvim` for nix-darwin.
## Usage
NixVim can be used in four ways: through the home-manager, nix-darwin, NixOS modules,
and standalone through the `makeNixvim` function. To use the modules, just import the
`nixvim.homeManagerModules.nixvim`, `nixvim.nixDarwinModules.nixvim`, and
`nixvim.homeModules.nixvim`, `nixvim.nixDarwinModules.nixvim`, and
`nixvim.nixosModules.nixvim` modules, depending on which system
you're using.

Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ When used as a module, NixVim can be enabled though `programs.nixvim.enable`.

When using NixVim as a module you must import the NixVim module into your module system.
The three imports are:
- `<nixvim>.homeManagerModules.nixvim`
- `<nixvim>.homeModules.nixvim`
- `<nixvim>.nixosModules.nixvim`
- `<nixvim>.nixDarwinModules.nixvim`

Expand Down
12 changes: 10 additions & 2 deletions flake/wrappers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@
nixvim = import ../wrappers/nixos.nix self;
default = self.nixosModules.nixvim;
};
homeManagerModules = {
# Alias for backward compatibility
# Added 2025-05-25 in https://github.com/nix-community/nixvim/pull/3387
homeManagerModules =
let
cond = lib.trivial.oldestSupportedReleaseIsAtLeast 2505;
msg = "nixvim: flake output `homeManagerModules` has been renamed to `homeModules`.";
in
lib.warnIf cond msg self.homeModules;
homeModules = {
nixvim = import ../wrappers/hm.nix self;
default = self.homeManagerModules.nixvim;
default = self.homeModules.nixvim;
};
nixDarwinModules = {
nixvim = import ../wrappers/darwin.nix self;
Expand Down
2 changes: 1 addition & 1 deletion tests/nixpkgs-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let
)
{
nixos = self.nixosModules.default;
hm = self.homeManagerModules.default;
hm = self.homeModules.default;
nix-darwin = self.nixDarwinModules.default;
}
);
Expand Down
4 changes: 2 additions & 2 deletions tests/platforms/hm-extra-files-byte-compiling.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let
inherit pkgs;

modules = [
self.homeManagerModules.nixvim
self.homeModules.nixvim
config
{ programs.nixvim.performance.byteCompileLua.configs = true; }
];
Expand All @@ -50,7 +50,7 @@ let
inherit pkgs;

modules = [
self.homeManagerModules.nixvim
self.homeModules.nixvim
config
{ programs.nixvim.performance.byteCompileLua.configs = false; }
];
Expand Down
2 changes: 1 addition & 1 deletion tests/platforms/hm-submodule-merge.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let
];
}
)
self.homeManagerModules.nixvim
self.homeModules.nixvim
];
};
in
Expand Down
2 changes: 1 addition & 1 deletion tests/platforms/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ self.inputs.home-manager.lib.homeManagerConfiguration {

programs.home-manager.enable = true;
}
self.homeManagerModules.nixvim
self.homeModules.nixvim
];
}