forked from mirrors/nixpkgs
vim: supporting multiple sources:
- vim-nox: client-server implementation without X - latest: latest mercurial sources (still very stable) - default: latest release vim-plugins: Introduce an area to put vim plugins which are worth adding to nix because they need more effort than just "unpacking". Document that
This commit is contained in:
parent
a22f94b4f2
commit
71628d6e35
|
@ -1,14 +1,38 @@
|
|||
# TODO tidy up eg The patchelf code is patching gvim even if you don't build it..
|
||||
# but I have gvim with python support now :) - Marc
|
||||
args: with args;
|
||||
args@{source ? "latest", ...}: with args;
|
||||
|
||||
|
||||
let inherit (args.composableDerivation) composableDerivation edf; in
|
||||
composableDerivation {} {
|
||||
composableDerivation {} (fix: {
|
||||
|
||||
name = "vim_configurable-7.3";
|
||||
|
||||
src = args.fetchurl {
|
||||
url = ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2;
|
||||
sha256 = "079201qk8g9yisrrb0dn52ch96z3lzw6z473dydw9fzi0xp5spaw";
|
||||
enableParallelBuilding = true; # test this
|
||||
|
||||
src =
|
||||
builtins.getAttr source {
|
||||
"default" =
|
||||
# latest release
|
||||
args.fetchurl {
|
||||
url = ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2;
|
||||
sha256 = "079201qk8g9yisrrb0dn52ch96z3lzw6z473dydw9fzi0xp5spaw";
|
||||
};
|
||||
"vim-nox" =
|
||||
{
|
||||
# vim nox branch: client-server without X by uing sockets
|
||||
# REGION AUTO UPDATE: { name="vim-nox"; type="hg"; url="https://code.google.com/r/yukihironakadaira-vim-cmdsrv-nox/"; branch="cmdsrv-nox"; }
|
||||
src = (fetchurl { url = "http://mawercer.de/~nix/repos/vim-nox-hg-2082fc3.tar.bz2"; sha256 = "293164ca1df752b7f975fd3b44766f5a1db752de6c7385753f083499651bd13a"; });
|
||||
name = "vim-nox-hg-2082fc3";
|
||||
# END
|
||||
}.src;
|
||||
"latest" = {
|
||||
# vim latest usually is vim + bug fixes. So it should be very stable
|
||||
# REGION AUTO UPDATE: { name="vim"; type="hg"; url="https://vim.googlecode.com/hg"; }
|
||||
src = (fetchurl { url = "http://mawercer.de/~nix/repos/vim-hg-7f98896.tar.bz2"; sha256 = "efcb8cc5924b530631a8e5fc2a0622045c2892210d32d300add24aded51866f1"; });
|
||||
name = "vim-hg-7f98896";
|
||||
# END
|
||||
}.src;
|
||||
};
|
||||
|
||||
configureFlags = ["--enable-gui=auto" "--with-features=${args.features}"];
|
||||
|
@ -54,6 +78,7 @@ composableDerivation {} {
|
|||
cscopeSupport = config.vim.cscope or false;
|
||||
# add .nix filetype detection and minimal syntax highlighting support
|
||||
ftNixSupport = config.vim.ftNix or true;
|
||||
netbeansSupport = config.netbeans or true; # eg envim is using it
|
||||
};
|
||||
|
||||
#--enable-gui=OPTS X11 GUI default=auto OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon
|
||||
|
@ -85,4 +110,5 @@ composableDerivation {} {
|
|||
homepage = "www.vim.org";
|
||||
};
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
|
129
pkgs/misc/vim-plugins/default.nix
Normal file
129
pkgs/misc/vim-plugins/default.nix
Normal file
|
@ -0,0 +1,129 @@
|
|||
{fetchurl, stdenv, python, cmake, vim}:
|
||||
|
||||
/*
|
||||
About Vim and plugins
|
||||
=====================
|
||||
Let me tell you how Vim plugins work, so that you can decide on how to orginize
|
||||
your setup.
|
||||
|
||||
typical plugin files:
|
||||
|
||||
plugin/P1.vim
|
||||
autoload/P1.vim
|
||||
ftplugin/xyz.vim
|
||||
doc/plugin-documentation.txt
|
||||
README(.md) (nowadays thanks to github)
|
||||
|
||||
Traditionally plugins were installed into ~/.vim/* so it was your task to keep track
|
||||
of which files belong to what plugin. Now this problem is "fixed" by nix which
|
||||
assembles your profile for you.
|
||||
|
||||
|
||||
Vim offers the :h rtp setting which works for most plugins. Thus adding adding
|
||||
this to your .vimrc should make most plugins work:
|
||||
|
||||
set rtp+=~/.nix-profile/vim-plugins/YouCompleteMe
|
||||
" or for p in ["YouCompleteMe"] | exec 'set rtp+=~/.nix-profile/vim-plugins/'.p | endfor
|
||||
|
||||
Its what
|
||||
pathogen, vundle, vim-addon-manager (VAM) use.
|
||||
|
||||
VAM's benefits:
|
||||
- works around after/* directories if they are used in non ~/.vim locations
|
||||
- allows activating plugins at runtime, eg when you need them. (works around
|
||||
some au command hooks, eg required for TheNerdTree plugin)
|
||||
- VAM checkous out all sources (vim.sf.net, git, mercurial, ...)
|
||||
- runs :helptags on update/installation only. Obviously it cannot do that on
|
||||
store paths.
|
||||
|
||||
VAM is made up of
|
||||
- the code loading plugins
|
||||
- an optional pool (github.com/MarcWeber/vim-addon-manager-known-repositories)
|
||||
|
||||
That pool probably is the best source to automatically derive plugin
|
||||
information from or to lookup about how to get data from www.vim.org.
|
||||
|
||||
I'm not sure we should package them all. Most of them are not used much.
|
||||
You need your .vimrc anyway, and then VAM gets the job done ?
|
||||
|
||||
How to install VAM? eg provide such a bash function:
|
||||
|
||||
vim-install-vam () {
|
||||
mkdir -p ~/.vim/vim-addons && git clone --depth=1 git://github.com/MarcWeber/vim-addon-manager.git ~/.vim/vim-addons/vim-addon-manager && cat >> ~/.vimrc <<EOF
|
||||
set nocompatible
|
||||
set hidden
|
||||
filetype indent plugin on | syn on
|
||||
fun ActivateAddons()
|
||||
let g:vim_addon_manager = {}
|
||||
let g:vim_addon_manager.log_to_buf =1
|
||||
set runtimepath+=~/.vim/vim-addons/vim-addon-manager
|
||||
call vam#ActivateAddons([])
|
||||
endf
|
||||
call ActivateAddons()
|
||||
EOF
|
||||
}
|
||||
|
||||
IMHO having no plugins listed might be better than having outdated ones.
|
||||
|
||||
So which plugins to add here according to what Marc Weber thinks is best?
|
||||
complicated plugins requiring dependencies, such as YouCompleteMe.
|
||||
Then its best to symlink ~/.nix-profile/vim-plugins/YouCompleteMe to
|
||||
~/.vim/{vim-addons,bundle} or whatever plugin management solution you use.
|
||||
|
||||
If you feel differently change the comments and proceed.
|
||||
*/
|
||||
|
||||
let vimHelptags = path: ''
|
||||
${vim}/bin/vim -N -u NONE -i NONE -n -e -s -c "helptags ${path}" +quit!
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
#TODO :helptags should be run
|
||||
|
||||
vimAddonNix = {
|
||||
# github.com/MarcWeber/vim-addon-nix provides some additional support for
|
||||
# editing .nix files
|
||||
|
||||
# This is a placeholder, because I think you always should be using latest git version
|
||||
};
|
||||
|
||||
YouCompleteMe = stdenv.mkDerivation {
|
||||
# REGION AUTO UPDATE: { name="youcompleteme"; type="git"; url="git://github.com/Valloric/YouCompleteMe"; }
|
||||
src = (fetchurl { url = "http://mawercer.de/~nix/repos/youcompleteme-git-97306.tar.bz2"; sha256 = "b9b892f5a723370c2034491dc72a4ca722c6cf1e5de4d60501141bba151bc719"; });
|
||||
name = "youcompleteme-git-97306";
|
||||
# END
|
||||
buildInputs = [ python cmake ];
|
||||
|
||||
configurePhase = ":";
|
||||
|
||||
buildPhase = ''
|
||||
set -x
|
||||
target=$out/vim-plugins/YouCompleteMe
|
||||
mkdir -p $target
|
||||
cp -a ./ $target
|
||||
|
||||
mkdir $target/build
|
||||
cd $target/build
|
||||
cmake -G "Unix Makefiles" . $target/cpp -DPYTHON_LIBRARIES:PATH=${python}/lib/libpython2.7.so -DPYTHON_INCLUDE_DIR:PATH=${python}/include/python2.7
|
||||
make -j -j''${NIX_BUILD_CORES} -l''${NIX_BUILD_CORES}}
|
||||
|
||||
${vimHelptags "$out/vim-plugins/YouCompleteMe/doc"}
|
||||
'';
|
||||
|
||||
# TODO: implement proper install phase rather than keeping everything in store
|
||||
# TODO: support llvm based C completion, See README of git repository
|
||||
installPhase = ":";
|
||||
|
||||
meta = {
|
||||
description = "fastest non utf-8 aware word and C completion engine for Vim";
|
||||
homepage = http://github.com/Valloric/YouCompleteMe;
|
||||
license = stdenv.lib.licenses.gpl3;
|
||||
maintainers = [stdenv.lib.maintainers.marcweber];
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
|
@ -8095,7 +8095,7 @@ let
|
|||
|
||||
vimHugeX = vim_configurable;
|
||||
|
||||
vim_configurable = import ../applications/editors/vim/configurable.nix {
|
||||
vim_configurable = callPackage (import ../applications/editors/vim/configurable.nix) {
|
||||
inherit (pkgs) fetchurl stdenv ncurses pkgconfig gettext composableDerivation lib config;
|
||||
inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu libICE;
|
||||
inherit (pkgs) glib gtk;
|
||||
|
@ -8108,6 +8108,8 @@ let
|
|||
# optional features by flags
|
||||
flags = [ "python" "X11" ]; # only flag "X11" by now
|
||||
};
|
||||
vimLatest = vim_configurable.override { source = "latest"; };
|
||||
vimNox = vim_configurable.override { source = "vim-nox"; };
|
||||
|
||||
virtviewer = callPackage ../applications/virtualization/virt-viewer {};
|
||||
virtmanager = callPackage ../applications/virtualization/virt-manager {
|
||||
|
@ -9274,6 +9276,8 @@ let
|
|||
|
||||
viewnior = callPackage ../applications/graphics/viewnior { };
|
||||
|
||||
vimPlugins = callPackage ../misc/vim-plugins { };
|
||||
|
||||
vimprobable2 = callPackage ../applications/networking/browsers/vimprobable2 {
|
||||
inherit (gnome) libsoup;
|
||||
webkit = webkit_gtk2;
|
||||
|
|
Loading…
Reference in a new issue