Merge pull request #115 from NotAShelf/feature/customize-default-package

This commit is contained in:
NotAShelf 2023-08-02 13:41:55 +03:00 committed by GitHub
commit 98b92c64db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 12 deletions

View file

@ -20,6 +20,7 @@
<xi:include href="manual/default-configs.xml"/> <xi:include href="manual/default-configs.xml"/>
<xi:include href="manual/custom-configs.xml"/> <xi:include href="manual/custom-configs.xml"/>
<xi:include href="manual/custom-plugins.xml"/> <xi:include href="manual/custom-plugins.xml"/>
<xi:include href="manual/custom-package.xml"/>
<xi:include href="manual/home-manager.xml"/> <xi:include href="manual/home-manager.xml"/>
<xi:include href="manual/languages.xml"/> <xi:include href="manual/languages.xml"/>
<appendix xml:id="ch-options"> <appendix xml:id="ch-options">

View file

@ -0,0 +1,14 @@
[[ch-custom-package]]
== Custom Neovim Package
As of v0.5, you may now specify the neovim package that will be wrapped with your configuration. This is done with the `vim.package` option.
[source,nix]
----
{inputs, pkgs, ...}: {
# using the neovim-nightly overlay
config.vim.package = inputs.neovim-overlay.packages.${pkgs.system}.neovim;
}
----
The neovim-nightly-overlay always exposes an unwrapped package. If using a different source, you are highly recommended to get an "unwrapped" version of the neovim package,similar to `neovim-unwrapped` in nixpkgs.

View file

@ -41,3 +41,5 @@ https://github.com/notashelf[notashelf]:
* Added lsp_lines plugin for showing diagnostic messages * Added lsp_lines plugin for showing diagnostic messages
* Added a configuration option for choosing the leader key * Added a configuration option for choosing the leader key
* The package used for neovim is now customizable by the user, using <<opt-vim.package>>. For best results, always use an unwrapped package.

View file

@ -138,7 +138,7 @@ in {
${optionalString (!cfg.enableEditorconfig) '' ${optionalString (!cfg.enableEditorconfig) ''
let g:editorconfig = v:false let g:editorconfig = v:false
''} ''}
${optionalString (cfg.spellChecking.enable) '' ${optionalString cfg.spellChecking.enable ''
set spell set spell
set spelllang=${toString cfg.spellChecking.language} set spelllang=${toString cfg.spellChecking.language}
''} ''}

View file

@ -1,11 +1,19 @@
{ {
pkgs,
lib, lib,
config,
... ...
}: }:
with lib; with lib;
with builtins; { with builtins; {
options.vim = { options.vim = {
package = mkOption {
type = types.package;
default = pkgs.neovim-unwrapped;
description = ''
The neovim package to use. You will need to use an unwrapped package for this option to work as intended.
'';
};
debugMode = { debugMode = {
enable = mkEnableOption "debug mode"; enable = mkEnableOption "debug mode";
level = mkOption { level = mkOption {

View file

@ -6,7 +6,7 @@ inputs: {
extraSpecialArgs ? {}, extraSpecialArgs ? {},
}: let }: let
inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins; inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins;
inherit (builtins) map filter isString toString getAttr hasAttr attrNames; inherit (builtins) map filter isString toString getAttr;
inherit (pkgs.vimUtils) buildVimPluginFrom2Nix; inherit (pkgs.vimUtils) buildVimPluginFrom2Nix;
extendedLib = import ../lib/stdlib-extended.nix lib; extendedLib = import ../lib/stdlib-extended.nix lib;
@ -18,11 +18,7 @@ inputs: {
module = extendedLib.evalModules { module = extendedLib.evalModules {
modules = [configuration] ++ nvimModules; modules = [configuration] ++ nvimModules;
specialArgs = specialArgs = {modulesPath = toString ./.;} // extraSpecialArgs;
{
modulesPath = toString ./.;
}
// extraSpecialArgs;
}; };
buildPlug = {pname, ...} @ args: buildPlug = {pname, ...} @ args:
@ -59,9 +55,10 @@ inputs: {
(f: f != null) (f: f != null)
plugins); plugins);
neovim = wrapNeovim neovim-unwrapped { neovim = wrapNeovim vimOptions.package {
viAlias = vimOptions.viAlias; inherit (vimOptions) viAlias;
vimAlias = vimOptions.vimAlias; inherit (vimOptions) vimAlias;
configure = { configure = {
customRC = vimOptions.builtConfigRC; customRC = vimOptions.builtConfigRC;
@ -72,7 +69,6 @@ inputs: {
}; };
}; };
in { in {
imports = [./assertions.nix];
inherit (module) options config; inherit (module) options config;
inherit (module._module.args) pkgs; inherit (module._module.args) pkgs;
inherit neovim; inherit neovim;