Merge pull request #56277 from matix2267/vim-customizable-manpages

vim_customizable: Include manpages in the output
This commit is contained in:
Maximilian Bosch 2019-02-25 23:04:21 +01:00 committed by GitHub
commit 718de515b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -359,19 +359,57 @@ rec {
inherit vimrcFile; inherit vimrcFile;
# shell script with custom name passing [-u vimrc] [-U gvimrc] to vim # shell script with custom name passing [-u vimrc] [-U gvimrc] to vim
vimWithRC = {vimExecutable, name ? null, vimrcFile ? null, gvimrcFile ? null}: vimWithRC = {
let rcOption = o: file: stdenv.lib.optionalString (file != null) "-${o} ${file}"; vimExecutable,
in writeScriptBin (if name == null then "vim" else name) '' gvimExecutable,
vimManPages,
wrapManual,
wrapGui,
name ? "vim",
vimrcFile ? null,
gvimrcFile ? null,
vimExecutableName,
gvimExecutableName,
}:
let
rcOption = o: file: stdenv.lib.optionalString (file != null) "-${o} ${file}";
vimWrapperScript = writeScriptBin vimExecutableName ''
#!${stdenv.shell} #!${stdenv.shell}
exec ${vimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@" exec ${vimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@"
''; '';
gvimWrapperScript = writeScriptBin gvimExecutableName ''
#!${stdenv.shell}
exec ${gvimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@"
'';
in
buildEnv {
inherit name;
paths = [
vimWrapperScript
] ++ lib.optional wrapGui gvimWrapperScript
++ lib.optional wrapManual vimManPages
;
};
# add a customize option to a vim derivation # add a customize option to a vim derivation
makeCustomizable = vim: vim // { makeCustomizable = vim: vim // {
customize = { name, vimrcConfig }: vimWithRC { customize = {
name,
vimrcConfig,
wrapManual ? true,
wrapGui ? false,
vimExecutableName ? name,
gvimExecutableName ? (lib.concatStrings [ "g" name ]),
}: vimWithRC {
vimExecutable = "${vim}/bin/vim"; vimExecutable = "${vim}/bin/vim";
inherit name; gvimExecutable = "${vim}/bin/gvim";
inherit name wrapManual wrapGui vimExecutableName gvimExecutableName;
vimrcFile = vimrcFile vimrcConfig; vimrcFile = vimrcFile vimrcConfig;
vimManPages = buildEnv {
name = "vim-doc";
paths = [ vim ];
pathsToLink = [ "/share/man" ];
};
}; };
override = f: makeCustomizable (vim.override f); override = f: makeCustomizable (vim.override f);