From aecd4acfb48fe4eb53582e995954f7ef6ceee7e9 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 12 Oct 2020 22:50:49 +0200 Subject: [PATCH] neovim: apply nixfmt --- format | 1 - modules/programs/neovim.nix | 54 +++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/format b/format index 8c771b6d..042ec93a 100755 --- a/format +++ b/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 \ diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index fd45de85..ea58e3f3 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.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 = [ - { - assertion = cfg.configure == { } || moduleConfigure == { }; - message = "The programs.neovim option configure is mutually exclusive" - + " with extraConfig and plugins."; - } - ]; + 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; @@ -255,6 +249,6 @@ in programs.bash.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; }; programs.fish.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; }; - programs.zsh.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; }; + programs.zsh.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; }; }; }