Skip to content

Commit

Permalink
vim_configurable: change python version detection
Browse files Browse the repository at this point in the history
Instead of explicitly stating "I want version 3" or "I want version 2"
you now simply specify what the `python` argument will be, and
vim_configurable will set up the flags for you. `config.vim.python` must
be set, still.

There's currently a patch included in the vim_configurable derivation
for python2, this is disabled if we're using python3.

I also moved a lot of the gui packages (libX11, ...) into an `if...else`
statement to help clean up build with the gui disabled. Setting
`config.vim.guiSupport` to `false` should be enough to disable the X11
libraries from being included.

In all-packages.nix I added the `python = pkgs.python` argument, and
removed python from the list of unnamed inputs.
  • Loading branch information
KaiSforza committed Jun 1, 2015
1 parent 70cb6e6 commit f94f91d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
35 changes: 12 additions & 23 deletions pkgs/applications/editors/vim/configurable.nix
Expand Up @@ -29,6 +29,8 @@ let inherit (args.composableDerivation) composableDerivation edf;
source /etc/vim/vimrc
endif
'';
pythonVersion = if args.python ? isPy3 then "3"
else "";
in
composableDerivation {
} (fix: {
Expand Down Expand Up @@ -62,15 +64,16 @@ 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) && (args.python ? isPy2))
[ ./python_framework.patch ];

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

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

# most interpreters aren't tested yet.. (see python for example how to do it)
flags = {
Expand All @@ -92,26 +95,13 @@ composableDerivation {

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

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

Expand Down Expand Up @@ -144,7 +134,6 @@ 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;
Expand Down
3 changes: 2 additions & 1 deletion pkgs/top-level/all-packages.nix
Expand Up @@ -12638,12 +12638,13 @@ 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";

# optional features by flags
Expand Down

0 comments on commit f94f91d

Please sign in to comment.