mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01:00
neovim: apply nixfmt
This commit is contained in:
parent
18a05a9604
commit
aecd4acfb4
2 changed files with 24 additions and 31 deletions
1
format
1
format
|
@ -36,7 +36,6 @@ find . -name '*.nix' \
|
|||
! -path ./modules/programs/firefox.nix \
|
||||
! -path ./modules/programs/gpg.nix \
|
||||
! -path ./modules/programs/lesspipe.nix \
|
||||
! -path ./modules/programs/neovim.nix \
|
||||
! -path ./modules/programs/ssh.nix \
|
||||
! -path ./modules/programs/tmux.nix \
|
||||
! -path ./modules/programs/vscode.nix \
|
||||
|
|
|
@ -9,18 +9,16 @@ let
|
|||
extraPythonPackageType = mkOptionType {
|
||||
name = "extra-python-packages";
|
||||
description = "python packages in python.withPackages format";
|
||||
check = with types; (x: if isFunction x
|
||||
then isList (x pkgs.pythonPackages)
|
||||
else false);
|
||||
check = with types;
|
||||
(x: if isFunction x then isList (x pkgs.pythonPackages) else false);
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
extraPython3PackageType = mkOptionType {
|
||||
name = "extra-python3-packages";
|
||||
description = "python3 packages in python.withPackages format";
|
||||
check = with types; (x: if isFunction x
|
||||
then isList (x pkgs.python3Packages)
|
||||
else false);
|
||||
check = with types;
|
||||
(x: if isFunction x then isList (x pkgs.python3Packages) else false);
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
|
@ -44,21 +42,20 @@ let
|
|||
" ${p.plugin.pname} {{{
|
||||
${p.config}
|
||||
" }}}
|
||||
'' else "";
|
||||
'' else
|
||||
"";
|
||||
|
||||
moduleConfigure =
|
||||
optionalAttrs (cfg.extraConfig != "" || (lib.filter (hasAttr "config") cfg.plugins) != []) {
|
||||
customRC = cfg.extraConfig +
|
||||
pkgs.lib.concatMapStrings pluginConfig cfg.plugins;
|
||||
}
|
||||
// optionalAttrs (cfg.plugins != [] ) {
|
||||
moduleConfigure = optionalAttrs (cfg.extraConfig != ""
|
||||
|| (lib.filter (hasAttr "config") cfg.plugins) != [ ]) {
|
||||
customRC = cfg.extraConfig
|
||||
+ pkgs.lib.concatMapStrings pluginConfig cfg.plugins;
|
||||
} // optionalAttrs (cfg.plugins != [ ]) {
|
||||
packages.home-manager.start = map (x: x.plugin or x) cfg.plugins;
|
||||
};
|
||||
extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [])
|
||||
'' --prefix PATH : "${lib.makeBinPath cfg.extraPackages}"'';
|
||||
in
|
||||
extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [ ])
|
||||
''--prefix PATH : "${lib.makeBinPath cfg.extraPackages}"'';
|
||||
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
programs.neovim = {
|
||||
enable = mkEnableOption "Neovim";
|
||||
|
@ -107,7 +104,7 @@ in
|
|||
|
||||
extraPythonPackages = mkOption {
|
||||
type = with types; either extraPythonPackageType (listOf package);
|
||||
default = (_: []);
|
||||
default = (_: [ ]);
|
||||
defaultText = "ps: []";
|
||||
example = literalExample "(ps: with ps; [ pandas jedi ])";
|
||||
description = ''
|
||||
|
@ -135,7 +132,7 @@ in
|
|||
|
||||
extraPython3Packages = mkOption {
|
||||
type = with types; either extraPython3PackageType (listOf package);
|
||||
default = (_: []);
|
||||
default = (_: [ ]);
|
||||
defaultText = "ps: []";
|
||||
example = literalExample "(ps: with ps; [ python-language-server ])";
|
||||
description = ''
|
||||
|
@ -160,7 +157,7 @@ in
|
|||
|
||||
configure = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
default = { };
|
||||
example = literalExample ''
|
||||
configure = {
|
||||
customRC = $''''
|
||||
|
@ -233,20 +230,17 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertions = [{
|
||||
assertion = cfg.configure == { } || moduleConfigure == { };
|
||||
message = "The programs.neovim option configure is mutually exclusive"
|
||||
+ " with extraConfig and plugins.";
|
||||
}
|
||||
];
|
||||
}];
|
||||
|
||||
home.packages = [ cfg.finalPackage ];
|
||||
|
||||
programs.neovim.finalPackage = pkgs.wrapNeovim cfg.package {
|
||||
inherit (cfg)
|
||||
extraPython3Packages withPython3
|
||||
extraPythonPackages withPython
|
||||
extraPython3Packages withPython3 extraPythonPackages withPython
|
||||
withNodeJs withRuby viAlias vimAlias;
|
||||
|
||||
extraMakeWrapperArgs = extraMakeWrapperArgs;
|
||||
|
|
Loading…
Reference in a new issue