@@ -1,7 +1,7 @@
11# TODO tidy up eg The patchelf code is patching gvim even if you don't build it..
22# but I have gvim with python support now :) - Marc
33args@{ source ? "default", callPackage, fetchurl, stdenv, ncurses, pkgconfig, gettext
4−, composableDerivation, writeText, lib, config, glib, gtk2, gtk3, python, perl, tcl, ruby
4+, writeText, lib, config, glib, gtk2, gtk3, python, perl, tcl, ruby
55, libX11, libXext, libSM, libXpm, libXt, libXaw, libXau, libXmu
66, libICE
77, vimPlugins
@@ -10,13 +10,27 @@ args@{ source ? "default", callPackage, fetchurl, stdenv, ncurses, pkgconfig, ge
1010# apple frameworks
1111, CoreServices, CoreData, Cocoa, Foundation, libobjc, cf-private
1212
13−, wrapPythonDrv ? false
14−
13+, features ? "huge" # One of tiny, small, normal, big or huge
14+, wrapPythonDrv ? false
15+, guiSupport ? config.vim.gui or "auto"
16+, luaSupport ? config.vim.lua or true
17+, perlSupport ? config.vim.perl or false # Perl interpreter
18+, pythonSupport ? config.vim.python or true # Python interpreter
19+, rubySupport ? config.vim.ruby or true # Ruby interpreter
20+, nlsSupport ? config.vim.nls or false # Enable NLS (gettext())
21+, tclSupport ? config.vim.tcl or false # Include Tcl interpreter
22+, multibyteSupport ? config.vim.multibyte or false # Enable multibyte editing support
23+, cscopeSupport ? config.vim.cscope or true # Enable cscope interface
24+, netbeansSupport ? config.netbeans or true # Enable NetBeans integration support.
25+, ximSupport ? config.vim.xim or true # less than 15KB, needed for deadkeys
26+# By default, compile with darwin support if we're compiling on darwin, but
27+# allow this to be disabled by setting config.vim.darwin to false
28+, darwinSupport ? stdenv.isDarwin && (config.vim.darwin or true) # Enable Darwin support
29+, ftNixSupport ? config.vim.ftNix or true # Add .nix filetype detection and minimal syntax highlighting support
1530, ... }: with args;
1631
1732
1833let
19− inherit (args.composableDerivation) composableDerivation edf;
2034 nixosRuntimepath = writeText "nixos-vimrc" ''
2135 set nocompatible
2236 syntax on
@@ -48,148 +62,113 @@ let
4862 '';
4963
5064 common = callPackage ./common.nix {};
51−in
52−composableDerivation {
53−} (fix: rec {
54−
55− name = "vim_configurable-${version}";
56−
57− inherit (common) version postPatch hardeningDisable enableParallelBuilding meta;
58−
59− src = builtins.getAttr source {
60− "default" = common.src; # latest release
61−
62− "vim-nox" =
63− {
64− # vim nox branch: client-server without X by uing sockets
65− # REGION AUTO UPDATE: { name="vim-nox"; type="hg"; url="https://code.google.com/r/yukihironakadaira-vim-cmdsrv-nox/"; branch="cmdsrv-nox"; }
66− src = (fetchurl { url = "http://mawercer.de/~nix/repos/vim-nox-hg-2082fc3.tar.bz2"; sha256 = "293164ca1df752b7f975fd3b44766f5a1db752de6c7385753f083499651bd13a"; });
67− name = "vim-nox-hg-2082fc3";
68− # END
69− }.src;
70− };
71−
72− patches = [ ./cflags-prune.diff ];
73−
74− configureFlags
75− = [ "--enable-gui=${args.gui}" "--with-features=${args.features}" ];
76−
77− nativeBuildInputs = [ pkgconfig ];
78−
79− buildInputs
80− = [ ncurses libX11 libXext libSM libXpm libXt libXaw libXau
81− libXmu glib libICE ] ++ (if args.gui == "gtk3" then [gtk3] else [gtk2]);
82−
83− # most interpreters aren't tested yet.. (see python for example how to do it)
84− flags = {
85− ftNix = {
86− patches = [ ./ft-nix-support.patch ];
87− preConfigure = ''
88− cp ${vimPlugins.vim-nix.src}/ftplugin/nix.vim runtime/ftplugin/nix.vim
89− cp ${vimPlugins.vim-nix.src}/indent/nix.vim runtime/indent/nix.vim
90− cp ${vimPlugins.vim-nix.src}/syntax/nix.vim runtime/syntax/nix.vim
91− '';
92− };
93− }
94− // edf {
95− name = "darwin";
96− enable = {
97− buildInputs = [ CoreServices CoreData Cocoa Foundation libobjc cf-private ];
98− NIX_LDFLAGS = stdenv.lib.optional stdenv.isDarwin
99− "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation";
100− };
101− } #Disable Darwin (macOS) support.
102− // edf { name = "xsmp"; } #Disable XSMP session management
103− // edf { name = "xsmp_interact"; } #Disable XSMP interaction
104− // edf { name = "mzscheme"; feat = "mzschemeinterp";} #Include MzScheme interpreter.
105− // edf { name = "perl"; feat = "perlinterp"; enable = { nativeBuildInputs = [perl]; };} #Include Perl interpreter.
106−
107− // edf {
108− name = "python";
109− feat = "python${if python ? isPy3 then "3" else ""}interp";
110− enable = {
111− buildInputs = [ python ];
112− } // lib.optionalAttrs wrapPythonDrv {
113− nativeBuildInputs = [ makeWrapper ];
114− postInstall = ''
115− wrapProgram "$out/bin/vim" --prefix PATH : "${python}/bin"
116− '';
117− } // lib.optionalAttrs stdenv.isDarwin {
118− configureFlags
119− = [ "--enable-python${if python ? isPy3 then "3" else ""}interp=yes"
120− "--with-python${if python ? isPy3 then "3" else ""}-config-dir=${python}/lib"
121− "--disable-python${if python ? isPy3 then "" else "3"}interp" ];
122− };
123− }
124−
125− // edf { name = "tcl"; feat = "tclinterp"; enable = { buildInputs = [tcl]; }; } #Include Tcl interpreter.
126− // edf { name = "ruby"; feat = "rubyinterp"; enable = { buildInputs = [ruby]; };} #Include Ruby interpreter.
127− // edf {
128− name = "lua";
129− feat = "luainterp";
130− enable = {
131− buildInputs = [lua];
132− configureFlags = [
133− "--with-lua-prefix=${args.lua}"
134− "--enable-luainterp"
135− ];
136− };
137− }
138− // edf { name = "cscope"; } #Include cscope interface.
139− // edf { name = "workshop"; } #Include Sun Visual Workshop support.
140− // edf { name = "netbeans"; } #Disable NetBeans integration support.
141− // edf { name = "sniff"; feat = "sniff" ; } #Include Sniff interface.
142− // edf { name = "multibyte"; } #Include multibyte editing support.
143− // edf { name = "hangulinput"; feat = "hangulinput" ;} #Include Hangul input support.
144− // edf { name = "xim"; } #Include XIM input support.
145− // edf { name = "fontset"; } #Include X fontset output support.
146− // edf { name = "acl"; } #Don't check for ACL support.
147− // edf { name = "gpm"; } #Don't use gpm (Linux mouse daemon).
148− // edf { name = "nls"; enable = {nativeBuildInputs = [gettext];}; } #Don't support NLS (gettext()).
149− ;
150−
151− cfg = {
152− luaSupport = config.vim.lua or true;
153− pythonSupport = config.vim.python or true;
154− rubySupport = config.vim.ruby or true;
155− nlsSupport = config.vim.nls or false;
156− tclSupport = config.vim.tcl or false;
157− multibyteSupport = config.vim.multibyte or false;
158− cscopeSupport = config.vim.cscope or true;
159− netbeansSupport = config.netbeans or true; # eg envim is using it
160− ximSupport = config.vim.xim or true; # less than 15KB, needed for deadkeys
161−
162− # by default, compile with darwin support if we're compiling on darwin, but
163− # allow this to be disabled by setting config.vim.darwin to false
164− darwinSupport = stdenv.isDarwin && (config.vim.darwin or true);
165−
166− # add .nix filetype detection and minimal syntax highlighting support
167− ftNixSupport = config.vim.ftNix or true;
168− };
16965
170− #--enable-gui=OPTS X11 GUI default=auto OPTS=auto/no/gtk/gtk2/gtk3/gnome/gnome2/motif/athena/neXtaw/photon/carbon
171− /*
172− // edf "gtk_check" "gtk_check" { } #If auto-select GUI, check for GTK default=yes
173− // edf "gtk2_check" "gtk2_check" { } #If GTK GUI, check for GTK+ 2 default=yes
174− // edf "gnome_check" "gnome_check" { } #If GTK GUI, check for GNOME default=no
175− // edf "motif_check" "motif_check" { } #If auto-select GUI, check for Motif default=yes
176− // edf "athena_check" "athena_check" { } #If auto-select GUI, check for Athena default=yes
177− // edf "nextaw_check" "nextaw_check" { } #If auto-select GUI, check for neXtaw default=yes
178− // edf "carbon_check" "carbon_check" { } #If auto-select GUI, check for Carbon default=yes
179− // edf "gtktest" "gtktest" { } #Do not try to compile and run a test GTK program
180− */
66+ isPython3 = python.isPy3 or false;
18167
182− preInstall = ''
183− mkdir -p $out/share/applications $out/share/icons/{hicolor,locolor}/{16x16,32x32,48x48}/apps
184− '';
68+in stdenv.mkDerivation rec {
69+
70+ name = "vim_configurable-${version}";
71+
72+ inherit (common) version postPatch hardeningDisable enableParallelBuilding meta;
18573
186− postInstall = stdenv.lib.optionalString stdenv.isLinux ''
74+ src = builtins.getAttr source {
75+ "default" = common.src; # latest release
76+
77+ "vim-nox" =
78+ {
79+ # vim nox branch: client-server without X by uing sockets
80+ # REGION AUTO UPDATE: { name="vim-nox"; type="hg"; url="https://code.google.com/r/yukihironakadaira-vim-cmdsrv-nox/"; branch="cmdsrv-nox"; }
81+ src = (fetchurl { url = "http://mawercer.de/~nix/repos/vim-nox-hg-2082fc3.tar.bz2"; sha256 = "293164ca1df752b7f975fd3b44766f5a1db752de6c7385753f083499651bd13a"; });
82+ name = "vim-nox-hg-2082fc3";
83+ # END
84+ }.src;
85+ };
86+
87+ patches = [ ./cflags-prune.diff ] ++ stdenv.lib.optional ftNixSupport ./ft-nix-support.patch;
88+
89+ configureFlags = [
90+ "--enable-gui=${guiSupport}"
91+ "--with-features=${features}"
92+ "--disable-xsmp" # XSMP session management
93+ "--disable-xsmp_interact" # XSMP interaction
94+ "--disable-workshop" # Sun Visual Workshop support
95+ "--disable-sniff" # Sniff interface
96+ "--disable-hangulinput" # Hangul input support
97+ "--disable-fontset" # X fontset output support
98+ "--disable-acl" # ACL support
99+ "--disable-gpm" # GPM (Linux mouse daemon)
100+ "--disable-mzschemeinterp"
101+ "--disable-gtk_check"
102+ "--disable-gtk2_check"
103+ "--disable-gnome_check"
104+ "--disable-motif_check"
105+ "--disable-athena_check"
106+ "--disable-nextaf_check"
107+ "--disable-carbon_check"
108+ "--disable-gtktest"
109+ ]
110+ ++ stdenv.lib.optionals luaSupport [
111+ "--with-lua-prefix=${args.lua}"
112+ "--enable-luainterp"
113+ ]
114+ ++ stdenv.lib.optionals pythonSupport [
115+ "--enable-python${if isPython3 then "3" else ""}"
116+ ]
117+ ++ stdenv.lib.optionals (pythonSupport && stdenv.isDarwin) [ # Why only for Darwin?
118+ "--enable-python${if isPython3 then "3" else ""}interp=yes" # Duplicate?
119+ "--with-python${if isPython3 then "3" else ""}-config-dir=${python}/lib"
120+ "--disable-python${if isPython3 then "" else "3"}interp"
121+ ]
122+ ++ stdenv.lib.optional nlsSupport "--enable-nls"
123+ ++ stdenv.lib.optional perlSupport "--enable-perlinterp"
124+ ++ stdenv.lib.optional rubySupport "--enable-rubyinterp"
125+ ++ stdenv.lib.optional tclSupport "--enable-tclinterp"
126+ ++ stdenv.lib.optional multibyteSupport "--enable-multibyte"
127+ ++ stdenv.lib.optional cscopeSupport "--enable-cscope"
128+ ++ stdenv.lib.optional netbeansSupport "--enable-netbeans"
129+ ++ stdenv.lib.optional ximSupport "--enable-xim";
130+
131+ nativeBuildInputs = [
132+ pkgconfig
133+ ]
134+ ++ stdenv.lib.optional wrapPythonDrv makeWrapper
135+ ++ stdenv.lib.optional nlsSupport gettext
136+ ++ stdenv.lib.optional perlSupport perl
137+ ;
138+
139+ buildInputs = [ ncurses libX11 libXext libSM libXpm libXt libXaw libXau
140+ libXmu glib libICE ]
141+ ++ (if guiSupport == "gtk3" then [gtk3] else [gtk2])
142+ ++ stdenv.lib.optionals darwinSupport [ CoreServices CoreData Cocoa Foundation libobjc cf-private ]
143+ ++ stdenv.lib.optional luaSupport lua
144+ ++ stdenv.lib.optional pythonSupport python
145+ ++ stdenv.lib.optional tclSupport tcl
146+ ++ stdenv.lib.optional rubySupport ruby;
147+
148+ preConfigure = ''
149+ '' + stdenv.lib.optionalString ftNixSupport ''
150+ cp ${vimPlugins.vim-nix.src}/ftplugin/nix.vim runtime/ftplugin/nix.vim
151+ cp ${vimPlugins.vim-nix.src}/indent/nix.vim runtime/indent/nix.vim
152+ cp ${vimPlugins.vim-nix.src}/syntax/nix.vim runtime/syntax/nix.vim
153+ '';
154+
155+ NIX_LDFLAGS = stdenv.lib.optionalString (darwinSupport && stdenv.isDarwin)
156+ "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation";
157+
158+ postInstall = ''
159+ '' + stdenv.lib.optionalString stdenv.isLinux ''
187160 patchelf --set-rpath \
188161 "$(patchelf --print-rpath $out/bin/vim):${lib.makeLibraryPath buildInputs}" \
189162 "$out"/bin/{vim,gvim}
190163
191164 ln -sfn '${nixosRuntimepath}' "$out"/share/vim/vimrc
165+ '' + stdenv.lib.optionalString wrapPythonDrv ''
166+ wrapProgram "$out/bin/vim" --prefix PATH : "${python}/bin"
167+ '';
168+
169+ preInstall = ''
170+ mkdir -p $out/share/applications $out/share/icons/{hicolor,locolor}/{16x16,32x32,48x48}/apps
192171 '';
193172
194173 dontStrip = 1;
195−})
174+}