neovim-flake/flake/modules/home-manager.nix

65 lines
1.6 KiB
Nix
Raw Normal View History

# Home Manager module
packages: inputs: {
2023-03-31 17:17:06 +02:00
config,
pkgs,
2023-03-31 17:17:06 +02:00
lib ? pkgs.lib,
...
}: let
inherit (lib) maintainers;
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption literalExpression;
2024-04-14 15:51:20 +02:00
inherit (lib.types) attrsOf anything;
2023-03-31 17:17:06 +02:00
cfg = config.programs.neovim-flake;
inherit (import ../../configuration.nix inputs) neovimConfiguration;
neovimConfigured = neovimConfiguration {
inherit pkgs;
modules = [cfg.settings];
};
2023-03-31 17:17:06 +02:00
in {
meta.maintainers = with maintainers; [NotAShelf];
2023-03-31 17:17:06 +02:00
options.programs.neovim-flake = {
enable = mkEnableOption "neovim-flake, the extensible neovim-wrapper";
finalPackage = mkOption {
type = anything;
visible = false;
readOnly = true;
description = ''
The built neovim-flake package, wrapped with the user's configuration.
'';
};
2023-03-31 17:17:06 +02:00
settings = mkOption {
type = attrsOf anything;
2023-03-31 17:17:06 +02:00
default = {};
description = "Attribute set of neovim-flake preferences.";
2023-03-31 17:17:06 +02:00
example = literalExpression ''
{
vim.viAlias = false;
vim.vimAlias = true;
vim.lsp = {
enable = true;
formatOnSave = true;
lightbulb.enable = true;
lspsaga.enable = false;
nvimCodeActionMenu.enable = true;
trouble.enable = true;
lspSignature.enable = true;
rust.enable = false;
nix = true;
};
}
'';
};
2023-03-31 17:17:06 +02:00
};
config = mkIf cfg.enable {
home.packages = [cfg.finalPackage];
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
2023-04-02 19:11:46 +02:00
};
2023-03-31 17:05:28 +02:00
}