Merge master into staging-next
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
{ stdenv, lib, fetchFromGitHub, gnumake, pkg-config, wget, unzip, gawk
|
||||
, sqlite, which, luaPackages, installShellFiles, makeWrapper
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "openrussian-cli";
|
||||
version = "1.0.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rhaberkorn";
|
||||
repo = "openrussian-cli";
|
||||
rev = version;
|
||||
sha256 = "1ria7s7dpqip2wdwn35wmkry84g8ghdqnxc9cbxzzq63vl6pgvcn";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
gnumake pkg-config wget unzip gawk sqlite which installShellFiles makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = with luaPackages; [ lua luasql-sqlite3 luautf8 ];
|
||||
|
||||
makeFlags = [
|
||||
"LUA=${luaPackages.lua}/bin/lua"
|
||||
"LUAC=${luaPackages.lua}/bin/luac"
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
# Disable check as it's too slow.
|
||||
# doCheck = true;
|
||||
|
||||
#This is needed even though it's the default for some reason.
|
||||
checkTarget = "check";
|
||||
|
||||
# Can't use "make install" here
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin $out/share/openrussian
|
||||
cp openrussian-sqlite3.db $out/share/openrussian
|
||||
cp openrussian $out/bin
|
||||
|
||||
wrapProgram $out/bin/openrussian \
|
||||
--prefix LUA_PATH ';' "$LUA_PATH" \
|
||||
--prefix LUA_CPATH ';' "$LUA_CPATH"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
installShellCompletion --cmd openrussian --bash ./openrussian-completion.bash
|
||||
installManPage ./openrussian.1
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/rhaberkorn/openrussian-cli";
|
||||
description = "Offline Console Russian Dictionary (based on openrussian.org)";
|
||||
license = with licenses; [ gpl3Only mit cc-by-sa-40 ];
|
||||
maintainers = with maintainers; [ zane ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{ lib, stdenv, vim, vimPlugins, vim_configurable, neovim, buildEnv, writeText, writeScriptBin
|
||||
# tests available at pkgs/test/vim
|
||||
{ lib, stdenv, vim, vimPlugins, vim_configurable, buildEnv, writeText, writeScriptBin
|
||||
, nix-prefetch-hg, nix-prefetch-git
|
||||
, fetchFromGitHub, runtimeShell
|
||||
}:
|
||||
@@ -183,13 +184,49 @@ let
|
||||
|
||||
rtpPath = "share/vim-plugins";
|
||||
|
||||
nativeImpl = packages: lib.optionalString (packages != null)
|
||||
(let
|
||||
link = (packageName: dir: pluginPath: "ln -sf ${pluginPath}/share/vim-plugins/* $out/pack/${packageName}/${dir}");
|
||||
packageLinks = (packageName: {start ? [], opt ? []}:
|
||||
let
|
||||
# `nativeImpl` expects packages to be derivations, not strings (as
|
||||
# opposed to older implementations that have to maintain backwards
|
||||
# compatibility). Therefore we don't need to deal with "knownPlugins"
|
||||
# and can simply pass `null`.
|
||||
depsOfOptionalPlugins = lib.subtractLists opt (findDependenciesRecursively opt);
|
||||
startWithDeps = findDependenciesRecursively start;
|
||||
in
|
||||
[ "mkdir -p $out/pack/${packageName}/start" ]
|
||||
# To avoid confusion, even dependencies of optional plugins are added
|
||||
# to `start` (except if they are explicitly listed as optional plugins).
|
||||
++ (builtins.map (link packageName "start") (lib.unique (startWithDeps ++ depsOfOptionalPlugins)))
|
||||
++ ["mkdir -p $out/pack/${packageName}/opt"]
|
||||
++ (builtins.map (link packageName "opt") opt)
|
||||
);
|
||||
packDir = (packages:
|
||||
stdenv.mkDerivation {
|
||||
name = "vim-pack-dir";
|
||||
src = ./.;
|
||||
installPhase = lib.concatStringsSep "\n" (lib.flatten (lib.mapAttrsToList packageLinks packages));
|
||||
preferLocalBuild = true;
|
||||
}
|
||||
);
|
||||
in
|
||||
''
|
||||
set packpath^=${packDir packages}
|
||||
set runtimepath^=${packDir packages}
|
||||
'');
|
||||
|
||||
vimrcContent = {
|
||||
packages ? null,
|
||||
vam ? null,
|
||||
pathogen ? null,
|
||||
plug ? null,
|
||||
beforePlugins ? "",
|
||||
customRC ? ""
|
||||
beforePlugins ? ''
|
||||
" configuration generated by NIX
|
||||
set nocompatible
|
||||
'',
|
||||
customRC ? null
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -301,56 +338,16 @@ let
|
||||
call vam#Scripts(l, {})
|
||||
'');
|
||||
|
||||
nativeImpl = lib.optionalString (packages != null)
|
||||
(let
|
||||
link = (packageName: dir: pluginPath: "ln -sf ${pluginPath}/share/vim-plugins/* $out/pack/${packageName}/${dir}");
|
||||
packageLinks = (packageName: {start ? [], opt ? []}:
|
||||
let
|
||||
# `nativeImpl` expects packages to be derivations, not strings (as
|
||||
# opposed to older implementations that have to maintain backwards
|
||||
# compatibility). Therefore we don't need to deal with "knownPlugins"
|
||||
# and can simply pass `null`.
|
||||
depsOfOptionalPlugins = lib.subtractLists opt (findDependenciesRecursively opt);
|
||||
startWithDeps = findDependenciesRecursively start;
|
||||
in
|
||||
["mkdir -p $out/pack/${packageName}/start"]
|
||||
# To avoid confusion, even dependencies of optional plugins are added
|
||||
# to `start` (except if they are explicitly listed as optional plugins).
|
||||
++ (builtins.map (link packageName "start") (lib.unique (startWithDeps ++ depsOfOptionalPlugins)))
|
||||
++ ["mkdir -p $out/pack/${packageName}/opt"]
|
||||
++ (builtins.map (link packageName "opt") opt)
|
||||
);
|
||||
packDir = (packages:
|
||||
stdenv.mkDerivation {
|
||||
name = "vim-pack-dir";
|
||||
src = ./.;
|
||||
installPhase = lib.concatStringsSep
|
||||
"\n"
|
||||
(lib.flatten (lib.mapAttrsToList packageLinks packages));
|
||||
preferLocalBuild = true;
|
||||
}
|
||||
);
|
||||
in
|
||||
''
|
||||
set packpath^=${packDir packages}
|
||||
set runtimepath^=${packDir packages}
|
||||
entries = [
|
||||
beforePlugins
|
||||
vamImpl pathogenImpl plugImpl
|
||||
(nativeImpl packages)
|
||||
customRC
|
||||
];
|
||||
|
||||
filetype indent plugin on | syn on
|
||||
'');
|
||||
in
|
||||
lib.concatStringsSep "\n" (lib.filter (x: x != null && x != "") entries);
|
||||
|
||||
in ''
|
||||
" configuration generated by NIX
|
||||
set nocompatible
|
||||
|
||||
${beforePlugins}
|
||||
|
||||
${vamImpl}
|
||||
${pathogenImpl}
|
||||
${plugImpl}
|
||||
${nativeImpl}
|
||||
|
||||
${customRC}
|
||||
'';
|
||||
vimrcFile = settings: writeText "vimrc" (vimrcContent settings);
|
||||
|
||||
in
|
||||
@@ -448,8 +445,6 @@ rec {
|
||||
'';
|
||||
};
|
||||
|
||||
vim_with_vim2nix = vim_configurable.customize { name = "vim"; vimrcConfig.vam.pluginDictionaries = [ "vim-addon-vim2nix" ]; };
|
||||
|
||||
inherit (import ./build-vim-plugin.nix { inherit lib stdenv rtpPath vim; }) buildVimPlugin buildVimPluginFrom2Nix;
|
||||
|
||||
# used to figure out which python dependencies etc. neovim needs
|
||||
@@ -475,62 +470,4 @@ rec {
|
||||
nativePlugins = lib.concatMap ({start?[], opt?[], knownPlugins?vimPlugins}: start++opt) nativePluginsConfigs;
|
||||
in
|
||||
nativePlugins ++ nonNativePlugins;
|
||||
|
||||
|
||||
# test cases:
|
||||
test_vim_with_vim_nix_using_vam = vim_configurable.customize {
|
||||
name = "vim-with-vim-addon-nix-using-vam";
|
||||
vimrcConfig.vam.pluginDictionaries = [{name = "vim-nix"; }];
|
||||
};
|
||||
|
||||
test_vim_with_vim_nix_using_pathogen = vim_configurable.customize {
|
||||
name = "vim-with-vim-addon-nix-using-pathogen";
|
||||
vimrcConfig.pathogen.pluginNames = [ "vim-nix" ];
|
||||
};
|
||||
|
||||
test_vim_with_vim_nix_using_plug = vim_configurable.customize {
|
||||
name = "vim-with-vim-addon-nix-using-plug";
|
||||
vimrcConfig.plug.plugins = with vimPlugins; [ vim-nix ];
|
||||
};
|
||||
|
||||
test_vim_with_vim_nix = vim_configurable.customize {
|
||||
name = "vim-with-vim-addon-nix";
|
||||
vimrcConfig.packages.myVimPackage.start = with vimPlugins; [ vim-nix ];
|
||||
};
|
||||
|
||||
# only neovim makes use of `requiredPlugins`, test this here
|
||||
test_nvim_with_vim_nix_using_pathogen = neovim.override {
|
||||
configure.pathogen.pluginNames = [ "vim-nix" ];
|
||||
};
|
||||
|
||||
# regression test for https://github.com/NixOS/nixpkgs/issues/53112
|
||||
# The user may have specified their own plugins which may not be formatted
|
||||
# exactly as the generated ones. In particular, they may not have the `pname`
|
||||
# attribute.
|
||||
test_vim_with_custom_plugin = vim_configurable.customize {
|
||||
name = "vim_with_custom_plugin";
|
||||
vimrcConfig.vam.knownPlugins =
|
||||
vimPlugins // ({
|
||||
vim-trailing-whitespace = buildVimPluginFrom2Nix {
|
||||
name = "vim-trailing-whitespace";
|
||||
src = fetchFromGitHub {
|
||||
owner = "bronson";
|
||||
repo = "vim-trailing-whitespace";
|
||||
rev = "4c596548216b7c19971f8fc94e38ef1a2b55fee6";
|
||||
sha256 = "0f1cpnp1nxb4i5hgymjn2yn3k1jwkqmlgw1g02sq270lavp2dzs9";
|
||||
};
|
||||
# make sure string dependencies are handled
|
||||
dependencies = [ "vim-nix" ];
|
||||
};
|
||||
});
|
||||
vimrcConfig.vam.pluginDictionaries = [ { names = [ "vim-trailing-whitespace" ]; } ];
|
||||
};
|
||||
|
||||
# system remote plugin manifest should be generated, deoplete should be usable
|
||||
# without the user having to do `UpdateRemotePlugins`. To test, launch neovim
|
||||
# and do `:call deoplete#enable()`. It will print an error if the remote
|
||||
# plugin is not registered.
|
||||
test_nvim_with_remote_plugin = neovim.override {
|
||||
configure.pathogen.pluginNames = with vimPlugins; [ deoplete-nvim ];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user