From 2537b7c679abd5d45d820869f47694521df6451f Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Thu, 29 Aug 2013 21:27:48 +0000 Subject: [PATCH] vim: add config option to generate vimrc --- pkgs/applications/editors/vim/default.nix | 8 +++--- pkgs/applications/editors/vim/wrapper.nix | 30 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 5 ++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 pkgs/applications/editors/vim/wrapper.nix diff --git a/pkgs/applications/editors/vim/default.nix b/pkgs/applications/editors/vim/default.nix index 7dd4a0519ce..67317490412 100644 --- a/pkgs/applications/editors/vim/default.nix +++ b/pkgs/applications/editors/vim/default.nix @@ -1,8 +1,10 @@ { stdenv, fetchhg, ncurses, gettext, pkgconfig }: stdenv.mkDerivation rec { - name = "vim-7.4.131"; - + name = "vim-${version}"; + + version = "7.4.131"; + src = fetchhg { url = "https://vim.googlecode.com/hg/"; tag = "v7-4-131"; @@ -10,7 +12,7 @@ stdenv.mkDerivation rec { }; enableParallelBuilding = true; - + buildInputs = [ ncurses pkgconfig ]; nativeBuildInputs = [ gettext ]; diff --git a/pkgs/applications/editors/vim/wrapper.nix b/pkgs/applications/editors/vim/wrapper.nix new file mode 100644 index 00000000000..709753ff8eb --- /dev/null +++ b/pkgs/applications/editors/vim/wrapper.nix @@ -0,0 +1,30 @@ +{ stdenv, makeWrapper, writeText, vim, vimrc }: + +let + + vimrcfile = writeText "vimrc" (if vimrc == null then "" else vimrc); + +in stdenv.mkDerivation rec { + name = "vimwrapper-${vim.version}"; + + buildInputs = [ makeWrapper vim vimrcfile ]; + + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p $out + cp -r ${vim}/* $out/ + + chmod u+w $out/bin + chmod u+w $out/share/vim + + ln -s ${vimrcfile} $out/share/vim/vimrc + wrapProgram $out/bin/vim --set VIM "$out/share/vim" + ''; + + meta = with stdenv.lib; { + description = "The most popular clone of the VI editor"; + homepage = http://www.vim.org; + platforms = platforms.unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7e8a3d89f39..ded6a364512 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9009,6 +9009,11 @@ let else stdenv; }; + vimwrapper = callPackage ../applications/editors/vim/wrapper.nix { + inherit vim; + vimrc = config.vim.vimrc or null; + }; + vimHugeX = vim_configurable; vim_configurable = callPackage ../applications/editors/vim/configurable.nix {