2021-01-19 06:50:56 +00:00
|
|
|
{ source ? "default", callPackage, lib, stdenv, ncurses, pkg-config, gettext
|
2020-11-02 11:26:49 +00:00
|
|
|
, writeText, config, glib, gtk2-x11, gtk3-x11, lua, python3, perl, tcl, ruby
|
2023-05-31 07:45:41 +00:00
|
|
|
, libX11, libXext, libSM, libXpm, libXt, libXaw, libXau, libXmu, libsodium
|
2015-10-19 23:46:23 +00:00
|
|
|
, libICE
|
2018-04-24 20:56:25 +00:00
|
|
|
, vimPlugins
|
2022-03-14 13:56:33 +00:00
|
|
|
, makeWrapper
|
2018-08-09 09:11:24 +00:00
|
|
|
, wrapGAppsHook
|
2019-02-26 11:45:54 +00:00
|
|
|
, runtimeShell
|
2015-10-19 23:46:23 +00:00
|
|
|
|
|
|
|
# apple frameworks
|
2019-06-19 21:18:39 +00:00
|
|
|
, CoreServices, CoreData, Cocoa, Foundation, libobjc
|
2015-10-19 23:46:23 +00:00
|
|
|
|
2018-07-21 11:48:19 +00:00
|
|
|
, features ? "huge" # One of tiny, small, normal, big or huge
|
|
|
|
, wrapPythonDrv ? false
|
2020-03-08 08:29:00 +00:00
|
|
|
, guiSupport ? config.vim.gui or (if stdenv.isDarwin then "gtk2" else "gtk3")
|
2018-07-21 11:48:19 +00:00
|
|
|
, luaSupport ? config.vim.lua or true
|
|
|
|
, perlSupport ? config.vim.perl or false # Perl interpreter
|
|
|
|
, pythonSupport ? config.vim.python or true # Python interpreter
|
|
|
|
, rubySupport ? config.vim.ruby or true # Ruby interpreter
|
|
|
|
, nlsSupport ? config.vim.nls or false # Enable NLS (gettext())
|
|
|
|
, tclSupport ? config.vim.tcl or false # Include Tcl interpreter
|
|
|
|
, multibyteSupport ? config.vim.multibyte or false # Enable multibyte editing support
|
|
|
|
, cscopeSupport ? config.vim.cscope or true # Enable cscope interface
|
|
|
|
, netbeansSupport ? config.netbeans or true # Enable NetBeans integration support.
|
|
|
|
, ximSupport ? config.vim.xim or true # less than 15KB, needed for deadkeys
|
2018-08-19 19:52:51 +00:00
|
|
|
, darwinSupport ? config.vim.darwin or false # Enable Darwin support
|
2023-06-06 17:21:07 +00:00
|
|
|
, ftNixSupport ? config.vim.ftNix or true # Add nix indentation support from vim-nix (not needed for basic syntax highlighting)
|
2023-05-31 07:45:41 +00:00
|
|
|
, sodiumSupport ? config.vim.sodium or true # Enable sodium based encryption
|
2018-08-19 19:39:10 +00:00
|
|
|
}:
|
2014-06-28 20:34:48 +00:00
|
|
|
|
|
|
|
|
2016-11-07 14:10:32 +00:00
|
|
|
let
|
|
|
|
nixosRuntimepath = writeText "nixos-vimrc" ''
|
2014-07-09 20:01:14 +00:00
|
|
|
set nocompatible
|
|
|
|
syntax on
|
|
|
|
|
2014-06-28 20:34:48 +00:00
|
|
|
function! NixosPluginPath()
|
|
|
|
let seen = {}
|
|
|
|
for p in reverse(split($NIX_PROFILES))
|
|
|
|
for d in split(glob(p . '/share/vim-plugins/*'))
|
|
|
|
let pluginname = substitute(d, ".*/", "", "")
|
|
|
|
if !has_key(seen, pluginname)
|
|
|
|
exec 'set runtimepath^='.d
|
2017-07-14 12:22:36 +00:00
|
|
|
let after = d."/after"
|
|
|
|
if isdirectory(after)
|
|
|
|
exec 'set runtimepath^='.after
|
|
|
|
endif
|
2014-06-28 20:34:48 +00:00
|
|
|
let seen[pluginname] = 1
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
endfor
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
execute NixosPluginPath()
|
2014-07-09 19:45:26 +00:00
|
|
|
|
|
|
|
if filereadable("/etc/vimrc")
|
|
|
|
source /etc/vimrc
|
|
|
|
elseif filereadable("/etc/vim/vimrc")
|
|
|
|
source /etc/vim/vimrc
|
|
|
|
endif
|
2014-06-28 20:34:48 +00:00
|
|
|
'';
|
2016-11-07 14:10:32 +00:00
|
|
|
|
|
|
|
common = callPackage ./common.nix {};
|
2007-12-12 07:20:41 +00:00
|
|
|
|
2023-06-06 17:21:07 +00:00
|
|
|
in stdenv.mkDerivation {
|
2018-07-21 11:48:19 +00:00
|
|
|
|
2022-12-04 10:18:38 +00:00
|
|
|
pname = "vim-full";
|
2018-07-21 11:48:19 +00:00
|
|
|
|
|
|
|
inherit (common) version postPatch hardeningDisable enableParallelBuilding meta;
|
2017-02-05 02:29:59 +00:00
|
|
|
|
2018-07-21 11:48:19 +00:00
|
|
|
src = builtins.getAttr source {
|
2019-08-13 21:52:01 +00:00
|
|
|
default = common.src; # latest release
|
2018-07-21 11:48:19 +00:00
|
|
|
};
|
|
|
|
|
2023-06-06 17:21:07 +00:00
|
|
|
patches = [ ./cflags-prune.diff ];
|
2018-07-21 11:48:19 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-features=${features}"
|
|
|
|
"--disable-xsmp" # XSMP session management
|
|
|
|
"--disable-xsmp_interact" # XSMP interaction
|
|
|
|
"--disable-workshop" # Sun Visual Workshop support
|
|
|
|
"--disable-sniff" # Sniff interface
|
|
|
|
"--disable-hangulinput" # Hangul input support
|
|
|
|
"--disable-fontset" # X fontset output support
|
|
|
|
"--disable-acl" # ACL support
|
|
|
|
"--disable-gpm" # GPM (Linux mouse daemon)
|
|
|
|
"--disable-mzschemeinterp"
|
|
|
|
"--disable-gtk_check"
|
|
|
|
"--disable-gtk2_check"
|
|
|
|
"--disable-gnome_check"
|
|
|
|
"--disable-motif_check"
|
|
|
|
"--disable-athena_check"
|
|
|
|
"--disable-nextaf_check"
|
|
|
|
"--disable-carbon_check"
|
|
|
|
"--disable-gtktest"
|
2021-09-17 20:34:14 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
|
|
"vim_cv_toupper_broken=no"
|
|
|
|
"--with-tlib=ncurses"
|
|
|
|
"vim_cv_terminfo=yes"
|
|
|
|
"vim_cv_tgetent=zero" # it does on native anyway
|
|
|
|
"vim_cv_tty_group=tty"
|
|
|
|
"vim_cv_tty_mode=0660"
|
|
|
|
"vim_cv_getcwd_broken=no"
|
|
|
|
"vim_cv_stat_ignores_slash=yes"
|
|
|
|
"vim_cv_memmove_handles_overlap=yes"
|
2018-07-21 11:48:19 +00:00
|
|
|
]
|
2021-03-20 11:01:48 +00:00
|
|
|
++ lib.optional (guiSupport == "gtk2" || guiSupport == "gtk3") "--enable-gui=${guiSupport}"
|
2021-01-15 13:21:58 +00:00
|
|
|
++ lib.optional stdenv.isDarwin
|
2018-08-19 19:52:51 +00:00
|
|
|
(if darwinSupport then "--enable-darwin" else "--disable-darwin")
|
2021-01-15 13:21:58 +00:00
|
|
|
++ lib.optionals luaSupport [
|
2018-08-19 19:39:10 +00:00
|
|
|
"--with-lua-prefix=${lua}"
|
2018-07-21 11:48:19 +00:00
|
|
|
"--enable-luainterp"
|
2022-10-06 16:38:53 +00:00
|
|
|
] ++ lib.optionals lua.pkgs.isLuaJIT [
|
2020-06-20 08:53:02 +00:00
|
|
|
"--with-luajit"
|
2018-07-21 11:48:19 +00:00
|
|
|
]
|
2021-01-15 13:21:58 +00:00
|
|
|
++ lib.optionals pythonSupport [
|
2020-11-02 11:26:49 +00:00
|
|
|
"--enable-python3interp=yes"
|
|
|
|
"--with-python3-config-dir=${python3}/lib"
|
|
|
|
# Disables Python 2
|
|
|
|
"--disable-pythoninterp"
|
2018-07-21 11:48:19 +00:00
|
|
|
]
|
2021-01-15 13:21:58 +00:00
|
|
|
++ lib.optional nlsSupport "--enable-nls"
|
|
|
|
++ lib.optional perlSupport "--enable-perlinterp"
|
|
|
|
++ lib.optional rubySupport "--enable-rubyinterp"
|
|
|
|
++ lib.optional tclSupport "--enable-tclinterp"
|
|
|
|
++ lib.optional multibyteSupport "--enable-multibyte"
|
|
|
|
++ lib.optional cscopeSupport "--enable-cscope"
|
|
|
|
++ lib.optional netbeansSupport "--enable-netbeans"
|
2023-05-31 07:45:41 +00:00
|
|
|
++ lib.optional ximSupport "--enable-xim"
|
|
|
|
++ lib.optional sodiumSupport "--enable-sodium";
|
2018-07-21 11:48:19 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2018-07-21 11:48:19 +00:00
|
|
|
]
|
2021-01-15 13:21:58 +00:00
|
|
|
++ lib.optional wrapPythonDrv makeWrapper
|
|
|
|
++ lib.optional nlsSupport gettext
|
|
|
|
++ lib.optional perlSupport perl
|
2022-03-14 13:56:33 +00:00
|
|
|
++ lib.optional (guiSupport == "gtk3") wrapGAppsHook
|
2018-07-21 11:48:19 +00:00
|
|
|
;
|
|
|
|
|
2021-03-20 11:01:48 +00:00
|
|
|
buildInputs = [
|
|
|
|
ncurses
|
|
|
|
glib
|
|
|
|
]
|
|
|
|
# All X related dependencies
|
|
|
|
++ lib.optionals (guiSupport == "gtk2" || guiSupport == "gtk3") [
|
|
|
|
libSM
|
|
|
|
libICE
|
|
|
|
libX11
|
|
|
|
libXext
|
|
|
|
libXpm
|
|
|
|
libXt
|
|
|
|
libXaw
|
|
|
|
libXau
|
|
|
|
libXmu
|
|
|
|
]
|
2021-01-15 13:21:58 +00:00
|
|
|
++ lib.optional (guiSupport == "gtk2") gtk2-x11
|
|
|
|
++ lib.optional (guiSupport == "gtk3") gtk3-x11
|
|
|
|
++ lib.optionals darwinSupport [ CoreServices CoreData Cocoa Foundation libobjc ]
|
|
|
|
++ lib.optional luaSupport lua
|
|
|
|
++ lib.optional pythonSupport python3
|
|
|
|
++ lib.optional tclSupport tcl
|
2023-05-31 07:45:41 +00:00
|
|
|
++ lib.optional rubySupport ruby
|
|
|
|
++ lib.optional sodiumSupport libsodium;
|
2018-07-21 11:48:19 +00:00
|
|
|
|
2023-04-28 05:32:48 +00:00
|
|
|
# error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
|
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-fdeclspec";
|
|
|
|
|
2023-06-06 17:21:07 +00:00
|
|
|
preConfigure = lib.optionalString ftNixSupport ''
|
2018-07-21 11:48:19 +00:00
|
|
|
cp ${vimPlugins.vim-nix.src}/ftplugin/nix.vim runtime/ftplugin/nix.vim
|
|
|
|
cp ${vimPlugins.vim-nix.src}/indent/nix.vim runtime/indent/nix.vim
|
|
|
|
'';
|
|
|
|
|
2019-10-21 17:16:52 +00:00
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/share/applications $out/share/icons/{hicolor,locolor}/{16x16,32x32,48x48}/apps
|
|
|
|
'';
|
|
|
|
|
2018-07-21 11:48:19 +00:00
|
|
|
postInstall = ''
|
2019-10-21 17:16:52 +00:00
|
|
|
ln -s $out/bin/vim $out/bin/vi
|
2021-01-15 13:21:58 +00:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2016-11-07 14:45:48 +00:00
|
|
|
ln -sfn '${nixosRuntimepath}' "$out"/share/vim/vimrc
|
2022-03-19 19:04:20 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = lib.optionalString wrapPythonDrv ''
|
vim_configurable: restore python derivation overriding
In the current Vim, the Python support can be implemented by linking to
the Python library, e.g., lib/libpython3.8.dylib on darwin. The
previous workaround of wrapping Vim to prefix $PATH is not sufficient
anymore. Since in the current Vim, the Python interpreter is no longer
invoked, but instead, the dynamically linked library is used, in which
only the original Python modules are loaded, causing plugins to fail
to load their required Python modules.
Experiments show that, however, it is controlled by the $NIX_PYTHONPATH
environment variable. In this commit, we add the required environment
variable to the wrapped Vim workaround as previously proposed. So that
the Vim plugins can use Python modules in the specified Python derivation.
2020-11-17 18:49:36 +00:00
|
|
|
wrapProgram "$out/bin/vim" --prefix PATH : "${python3}/bin" \
|
|
|
|
--set NIX_PYTHONPATH "${python3}/${python3.sitePackages}"
|
2018-07-21 11:48:19 +00:00
|
|
|
'';
|
|
|
|
|
2019-10-21 17:16:52 +00:00
|
|
|
dontStrip = true;
|
2018-07-21 11:48:19 +00:00
|
|
|
}
|