Skip to content

Commit

Permalink
vim: Change python3 ver setting, add nogui version
Browse files Browse the repository at this point in the history
Instead of having a specific python3 configuration option, we now just
check the args.python variable passed. This can be trivially set using
stdenv.lib.overrideDerivation.

The nogui part required a bit more changes, completely removing all of
the package requirements in the configurable.nix package, splitting it
all out to the definition in all-packages.nix.

There is a new variable, args.X11, that specifies the build inputs for
building Vim with support for X. On systems where X may not be
available, using the nogui version will set args.X11 to an emply list,
causing none of the X dependencies to be built for Vim. The gui option
is set to "no" in the nogui option, but can be manually overriden with
the overrideDerivation, though then "X11" will have to also be manually
set.
  • Loading branch information
KaiSforza committed Apr 28, 2015
1 parent 8150cf1 commit e2cfe27
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 19 deletions.
36 changes: 18 additions & 18 deletions pkgs/applications/editors/vim/configurable.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ let inherit (args.composableDerivation) composableDerivation edf;
source /etc/vim/vimrc
endif
'';
pythonVersion =
if (builtins.compareVersions args.python.version "3") > -1 then
{ enable = "3"; disable = ""; }
else
{ enable = ""; disable = "3"; };
in
composableDerivation {
} (fix: {
Expand Down Expand Up @@ -62,15 +67,14 @@ composableDerivation {
# if darwin support is enabled, we want to make sure we're not building with
# OS-installed python framework
patches = stdenv.lib.optionals
(stdenv.isDarwin && (config.vim.darwin or true))
(stdenv.isDarwin && (config.vim.darwin or true) && pythonVersion.disable == "3")
[ ./python_framework.patch ];

configureFlags
= [ "--enable-gui=${args.gui}" "--with-features=${args.features}" ];
= [ "--with-features=${args.features}" ];

nativeBuildInputs
= [ ncurses pkgconfig gtk libX11 libXext libSM libXpm libXt libXaw libXau
libXmu glib libICE ];
= [ ncurses pkgconfig ];

# most interpreters aren't tested yet.. (see python for example how to do it)
flags = {
Expand All @@ -91,27 +95,23 @@ composableDerivation {
// edf { name = "perl"; feat = "perlinterp"; enable = { nativeBuildInputs = [perl]; };} #Include Perl interpreter.

// edf {
name = "python";
feat = "pythoninterp";
name = "gui";
feat = "gui";
enable = {
nativeBuildInputs = [ python ];
} // lib.optionalAttrs stdenv.isDarwin {
configureFlags
= [ "--enable-pythoninterp=yes"
"--with-python-config-dir=${python}/lib" ];
nativeBuildInputs = args.X11;
};
}

// edf {
name = "python3";
feat = "python3interp";
name = "python";
feat = "python${pythonVersion.enable}interp";
enable = {
nativeBuildInputs = [ pkgs.python3 ];
nativeBuildInputs = [ args.python ];
} // lib.optionalAttrs stdenv.isDarwin {
configureFlags
= [ "--enable-python3interp=yes"
"--with-python3-config-dir=${pkgs.python3}/lib"
"--disable-pythoninterp" ];
= [ "--enable-python${pythonVersion.enable}interp=yes"
"--with-python${pythonVersion.enable}-config-dir=${args.python}/lib"
"--disable-python${pythonVersion.disable}interp" ];
};
}

Expand Down Expand Up @@ -144,12 +144,12 @@ composableDerivation {
cfg = {
luaSupport = config.vim.lua or true;
pythonSupport = config.vim.python or true;
python3Support = config.vim.python3 or false;
rubySupport = config.vim.ruby or true;
nlsSupport = config.vim.nls or false;
tclSupport = config.vim.tcl or false;
multibyteSupport = config.vim.multibyte or false;
cscopeSupport = config.vim.cscope or true;
guiSupport = config.vim.gui or true;
netbeansSupport = config.netbeans or true; # eg envim is using it

# by default, compile with darwin support if we're compiling on darwin, but
Expand Down
27 changes: 26 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12271,18 +12271,43 @@ let

vim_configurable = vimUtils.makeCustomizable (callPackage ../applications/editors/vim/configurable.nix {
inherit (pkgs) fetchurl fetchhg stdenv ncurses pkgconfig gettext
composableDerivation lib config glib gtk python perl tcl ruby;
composableDerivation lib config glib gtk perl tcl ruby;
inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu
libICE;

features = "huge"; # one of tiny, small, normal, big or huge
lua = pkgs.lua5_1;
python = pkgs.python;
gui = config.vim.gui or "auto";
X11 = [ gtk
pkgs.xlibs.libX11
pkgs.xlibs.libXext
pkgs.xlibs.libSM
pkgs.xlibs.libXpm
pkgs.xlibs.libXt
pkgs.xlibs.libXaw
pkgs.xlibs.libXau
pkgs.xlibs.libXmu
pkgs.xlibs.libICE ];

# optional features by flags
flags = [ "python" "X11" ]; # only flag "X11" by now
});

vim_configurable_nogui = vimUtils.makeCustomizable (callPackage ../applications/editors/vim/configurable.nix {
inherit (pkgs) fetchurl fetchhg stdenv ncurses pkgconfig gettext
composableDerivation lib config glib perl tcl ruby;

features = "huge"; # one of tiny, small, normal, big or huge
lua = pkgs.lua5_1;
python = pkgs.python;
gui = "no";
X11 = [];

# optional features by flags
flags = [ "python" ];
});

vimNox = lowPrio (vim_configurable.override { source = "vim-nox"; });

qpdfview = callPackage ../applications/misc/qpdfview {};
Expand Down

0 comments on commit e2cfe27

Please sign in to comment.