neovim-flake/flake/modules/nixos.nix

63 lines
1.5 KiB
Nix
Raw Normal View History

# Home Manager module
packages: inputs: {
config,
pkgs,
lib ? pkgs.lib,
...
}: let
inherit (lib) maintainers;
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) attrsOf package anything;
cfg = config.programs.neovim-flake;
inherit (import ../../configuration.nix inputs) neovimConfiguration;
builtPackage = neovimConfiguration {
inherit pkgs;
modules = [cfg.settings];
};
in {
meta.maintainers = with maintainers; [NotAShelf];
options.programs.neovim-flake = {
enable = mkEnableOption "neovim-flake, the extensible neovim-wrapper";
builtPackage = mkOption {
type = package;
default = builtPackage;
internal = true;
description = ''
The built neovim-flake package, wrapped with the user's configuration.
'';
};
settings = mkOption {
type = attrsOf anything;
default = {};
description = "Attribute set of neovim-flake preferences.";
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;
};
}
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [builtPackage];
};
}