refactor: move lib out of modules

This commit is contained in:
NotAShelf 2023-02-06 21:57:35 +03:00
commit 89be2b9d37
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
8 changed files with 334 additions and 0 deletions

44
lib/hm-module.nix Normal file
View file

@ -0,0 +1,44 @@
# Home Manager module
{
config,
pkgs,
lib ? pkgs.lib,
...
}: let
cfg = config.programs.neovim-flake;
set = pkgs.neovim-maximal {mainConfig = cfg.settings;};
in
with lib; {
meta.maintainers = [maintainers.notashelf];
options.programs.neovim-flake = {
enable = mkEnableOption "A NeoVim IDE with a focus on configurability and extensibility.";
settings = mkOption {
type = types.attrsOf types.anything;
default = {};
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;
};
}
'';
description = "Attribute set of neoflake preferences.";
};
};
config = mkIf cfg.enable {
home.packages = [set.neovim];
};
}