uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
139
pkgs/applications/editors/neovim/default.nix
Normal file
139
pkgs/applications/editors/neovim/default.nix
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
{ lib, stdenv, fetchFromGitHub, cmake, gettext, msgpack, libtermkey, libiconv
|
||||
, libuv, lua, ncurses, pkg-config
|
||||
, unibilium, gperf
|
||||
, libvterm-neovim
|
||||
, tree-sitter
|
||||
, CoreServices
|
||||
, glibcLocales ? null, procps ? null
|
||||
|
||||
# now defaults to false because some tests can be flaky (clipboard etc), see
|
||||
# also: https://github.com/neovim/neovim/issues/16233
|
||||
, doCheck ? false
|
||||
, nodejs ? null, fish ? null, python3 ? null
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
neovimLuaEnv = lua.withPackages(ps:
|
||||
(with ps; [ lpeg luabitop mpack ]
|
||||
++ optionals doCheck [
|
||||
nvim-client luv coxpcall busted luafilesystem penlight inspect
|
||||
]
|
||||
));
|
||||
|
||||
pyEnv = python3.withPackages(ps: with ps; [ pynvim msgpack ]);
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "neovim-unwrapped";
|
||||
version = "0.7.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "neovim";
|
||||
repo = "neovim";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-eYYaHpfSaYYrLkcD81Y4rsAMYDP1IJ7fLJJepkACkA8=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# introduce a system-wide rplugin.vim in addition to the user one
|
||||
# necessary so that nix can handle `UpdateRemotePlugins` for the plugins
|
||||
# it installs. See https://github.com/neovim/neovim/issues/9413.
|
||||
./system_rplugin_manifest.patch
|
||||
];
|
||||
|
||||
dontFixCmake = true;
|
||||
|
||||
inherit lua;
|
||||
|
||||
buildInputs = [
|
||||
gperf
|
||||
libtermkey
|
||||
libuv
|
||||
libvterm-neovim
|
||||
# This is actually a c library, hence it's not included in neovimLuaEnv,
|
||||
# see:
|
||||
# https://github.com/luarocks/luarocks/issues/1402#issuecomment-1080616570
|
||||
# and it's definition at: pkgs/development/lua-modules/overrides.nix
|
||||
lua.pkgs.libluv
|
||||
msgpack
|
||||
ncurses
|
||||
neovimLuaEnv
|
||||
tree-sitter
|
||||
unibilium
|
||||
] ++ optionals stdenv.isDarwin [ libiconv CoreServices ]
|
||||
++ optionals doCheck [ glibcLocales procps ]
|
||||
;
|
||||
|
||||
inherit doCheck;
|
||||
|
||||
# to be exhaustive, one could run
|
||||
# make oldtests too
|
||||
checkPhase = ''
|
||||
make functionaltest
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
gettext
|
||||
pkg-config
|
||||
];
|
||||
|
||||
# extra programs test via `make functionaltest`
|
||||
checkInputs = [
|
||||
fish
|
||||
nodejs
|
||||
pyEnv # for src/clint.py
|
||||
];
|
||||
|
||||
|
||||
# nvim --version output retains compilation flags and references to build tools
|
||||
postPatch = ''
|
||||
substituteInPlace src/nvim/version.c --replace NVIM_VERSION_CFLAGS "";
|
||||
'';
|
||||
# check that the above patching actually works
|
||||
disallowedReferences = [ stdenv.cc ];
|
||||
|
||||
cmakeFlags = [
|
||||
# Don't use downloaded dependencies. At the end of the configurePhase one
|
||||
# can spot that cmake says this option was "not used by the project".
|
||||
# That's because all dependencies were found and
|
||||
# third-party/CMakeLists.txt is not read at all.
|
||||
"-DUSE_BUNDLED=OFF"
|
||||
]
|
||||
++ optional (!lua.pkgs.isLuaJIT) "-DPREFER_LUA=ON"
|
||||
;
|
||||
|
||||
# triggers on buffer overflow bug while running tests
|
||||
hardeningDisable = [ "fortify" ];
|
||||
|
||||
preConfigure = lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace src/nvim/CMakeLists.txt --replace " util" ""
|
||||
'';
|
||||
|
||||
shellHook=''
|
||||
export VIMRUNTIME=$PWD/runtime
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Vim text editor fork focused on extensibility and agility";
|
||||
longDescription = ''
|
||||
Neovim is a project that seeks to aggressively refactor Vim in order to:
|
||||
- Simplify maintenance and encourage contributions
|
||||
- Split the work between multiple developers
|
||||
- Enable the implementation of new/modern user interfaces without any
|
||||
modifications to the core source
|
||||
- Improve extensibility with a new plugin architecture
|
||||
'';
|
||||
homepage = "https://www.neovim.io";
|
||||
mainProgram = "nvim";
|
||||
# "Contributions committed before b17d96 by authors who did not sign the
|
||||
# Contributor License Agreement (CLA) remain under the Vim license.
|
||||
# Contributions committed after b17d96 are licensed under Apache 2.0 unless
|
||||
# those contributions were copied from Vim (identified in the commit logs
|
||||
# by the vim-patch token). See LICENSE for details."
|
||||
license = with licenses; [ asl20 vim ];
|
||||
maintainers = with maintainers; [ manveru rvolosatovs ma27 ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
50
pkgs/applications/editors/neovim/gnvim/default.nix
Normal file
50
pkgs/applications/editors/neovim/gnvim/default.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ lib, rustPlatform, fetchFromGitHub, gtk, webkitgtk }:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "gnvim-unwrapped";
|
||||
version = "0.1.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "vhakulinen";
|
||||
repo = "gnvim";
|
||||
rev = "v${version}";
|
||||
sha256 = "1cc3yk04v9icdjr5cn58mqc3ba1wqmlzhf9ly7biy9m8yk30w9y0";
|
||||
};
|
||||
|
||||
cargoSha256 = "0z6hhahxdc6d7nzqvc8jlxn1frsc39va8z5pmwfmmq5z61ahk90z";
|
||||
|
||||
buildInputs = [ gtk webkitgtk ];
|
||||
|
||||
# The default build script tries to get the version through Git, so we
|
||||
# replace it
|
||||
postPatch = ''
|
||||
cat << EOF > build.rs
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let dest_path = Path::new(&out_dir).join("gnvim_version.rs");
|
||||
let mut f = File::create(&dest_path).unwrap();
|
||||
f.write_all(b"const VERSION: &str = \"${version}\";").unwrap();
|
||||
}
|
||||
EOF
|
||||
|
||||
# Install the binary ourselves, since the Makefile doesn't have the path
|
||||
# containing the target architecture
|
||||
sed -e "/target\/release/d" -i Makefile
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
make install PREFIX="${placeholder "out"}"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "GUI for neovim, without any web bloat";
|
||||
homepage = "https://github.com/vhakulinen/gnvim";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ minijackson ];
|
||||
};
|
||||
}
|
||||
39
pkgs/applications/editors/neovim/gnvim/wrapper.nix
Normal file
39
pkgs/applications/editors/neovim/gnvim/wrapper.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{ stdenv, gnvim-unwrapped, neovim, makeWrapper }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "gnvim";
|
||||
version = gnvim-unwrapped.version;
|
||||
buildCommand = if stdenv.isDarwin then ''
|
||||
mkdir -p $out/Applications
|
||||
cp -r ${gnvim-unwrapped}/bin/gnvim.app $out/Applications
|
||||
|
||||
chmod -R a+w "$out/Applications/gnvim.app/Contents/MacOS"
|
||||
wrapProgram "$out/Applications/gnvim.app/Contents/MacOS/gnvim" \
|
||||
--prefix PATH : "${neovim}/bin" \
|
||||
--set GNVIM_RUNTIME_PATH "${gnvim-unwrapped}/share/gnvim/runtime"
|
||||
'' else ''
|
||||
makeWrapper '${gnvim-unwrapped}/bin/gnvim' "$out/bin/gnvim" \
|
||||
--prefix PATH : "${neovim}/bin" \
|
||||
--set GNVIM_RUNTIME_PATH "${gnvim-unwrapped}/share/gnvim/runtime"
|
||||
|
||||
mkdir -p "$out/share"
|
||||
ln -s '${gnvim-unwrapped}/share/icons' "$out/share/icons"
|
||||
|
||||
# copy and fix .desktop file
|
||||
cp -r '${gnvim-unwrapped}/share/applications' "$out/share/applications"
|
||||
# Sed needs a writable directory to do inplace modifications
|
||||
chmod u+rw "$out/share/applications"
|
||||
sed -e "s|Exec=.\\+gnvim\\>|Exec=gnvim|" -i $out/share/applications/*.desktop
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
passthru.unwrapped = gnvim-unwrapped;
|
||||
|
||||
inherit (gnvim-unwrapped) meta;
|
||||
}
|
||||
|
||||
134
pkgs/applications/editors/neovim/neovide/default.nix
Normal file
134
pkgs/applications/editors/neovim/neovide/default.nix
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
{ rustPlatform
|
||||
, runCommand
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, fetchgit
|
||||
, fetchurl
|
||||
, makeWrapper
|
||||
, pkg-config
|
||||
, python2
|
||||
, python3
|
||||
, openssl
|
||||
, SDL2
|
||||
, fontconfig
|
||||
, freetype
|
||||
, ninja
|
||||
, gn
|
||||
, llvmPackages
|
||||
, makeFontsConf
|
||||
, libglvnd
|
||||
, libxkbcommon
|
||||
, stdenv
|
||||
, enableWayland ? stdenv.isLinux
|
||||
, wayland
|
||||
, xorg
|
||||
}:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "neovide";
|
||||
version = "0.8.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Kethku";
|
||||
repo = "neovide";
|
||||
rev = version;
|
||||
sha256 = "sha256-pbniOWjEw1Z+PoXqbbFOUkW5Ii1UDOMoZpAvVF1uNEg=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-7o7uJXH68pvfuiG1eSNmbPx8OO8QJjCe+oEFl38bFm4=";
|
||||
|
||||
SKIA_SOURCE_DIR =
|
||||
let
|
||||
repo = fetchFromGitHub {
|
||||
owner = "rust-skia";
|
||||
repo = "skia";
|
||||
# see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
|
||||
rev = "m93-0.42.0";
|
||||
sha256 = "sha256-F1DWLm7bdKnuCu5tMMekxSyaGq8gPRNtZwcRVXJxjZQ=";
|
||||
};
|
||||
# The externals for skia are taken from skia/DEPS
|
||||
externals = lib.mapAttrs (n: fetchgit) (lib.importJSON ./skia-externals.json);
|
||||
in
|
||||
runCommand "source" {} (
|
||||
''
|
||||
cp -R ${repo} $out
|
||||
chmod -R +w $out
|
||||
|
||||
mkdir -p $out/third_party/externals
|
||||
cd $out/third_party/externals
|
||||
'' + (builtins.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "cp -ra ${value} ${name}") externals))
|
||||
);
|
||||
|
||||
SKIA_NINJA_COMMAND = "${ninja}/bin/ninja";
|
||||
SKIA_GN_COMMAND = "${gn}/bin/gn";
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
|
||||
preConfigure = ''
|
||||
unset CC CXX
|
||||
'';
|
||||
|
||||
# test needs a valid fontconfig file
|
||||
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
makeWrapper
|
||||
python2 # skia-bindings
|
||||
python3 # rust-xcb
|
||||
llvmPackages.clang # skia
|
||||
];
|
||||
|
||||
# All tests passes but at the end cargo prints for unknown reason:
|
||||
# error: test failed, to rerun pass '--bin neovide'
|
||||
# Increasing the loglevel did not help. In a nix-shell environment
|
||||
# the failure do not occure.
|
||||
doCheck = false;
|
||||
|
||||
buildInputs = [
|
||||
openssl
|
||||
SDL2
|
||||
(fontconfig.overrideAttrs (old: {
|
||||
propagatedBuildInputs = [
|
||||
# skia is not compatible with freetype 2.11.0
|
||||
(freetype.overrideAttrs (old: rec {
|
||||
version = "2.10.4";
|
||||
src = fetchurl {
|
||||
url = "mirror://savannah/${old.pname}/${old.pname}-${version}.tar.xz";
|
||||
sha256 = "112pyy215chg7f7fmp2l9374chhhpihbh8wgpj5nj6avj3c59a46";
|
||||
};
|
||||
}))
|
||||
];
|
||||
}))
|
||||
];
|
||||
|
||||
postFixup = let
|
||||
libPath = lib.makeLibraryPath ([
|
||||
libglvnd
|
||||
libxkbcommon
|
||||
xorg.libXcursor
|
||||
xorg.libXext
|
||||
xorg.libXrandr
|
||||
xorg.libXi
|
||||
] ++ lib.optionals enableWayland [ wayland ]);
|
||||
in ''
|
||||
wrapProgram $out/bin/neovide \
|
||||
--prefix LD_LIBRARY_PATH : ${libPath}
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
for n in 16x16 32x32 48x48 256x256; do
|
||||
install -m444 -D "assets/neovide-$n.png" \
|
||||
"$out/share/icons/hicolor/$n/apps/neovide.png"
|
||||
done
|
||||
install -m444 -Dt $out/share/icons/hicolor/scalable/apps assets/neovide.svg
|
||||
install -m444 -Dt $out/share/applications assets/neovide.desktop
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "This is a simple graphical user interface for Neovim.";
|
||||
homepage = "https://github.com/Kethku/neovide";
|
||||
license = with licenses; [ mit ];
|
||||
maintainers = with maintainers; [ ck3d ];
|
||||
platforms = platforms.linux;
|
||||
mainProgram = "neovide";
|
||||
};
|
||||
}
|
||||
37
pkgs/applications/editors/neovim/neovide/skia-externals.json
Normal file
37
pkgs/applications/editors/neovim/neovide/skia-externals.json
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"expat": {
|
||||
"url": "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git",
|
||||
"rev": "a28238bdeebc087071777001245df1876a11f5ee",
|
||||
"sha256": "sha256-TSaVtKEk7J0fckDvpI6/U5Aq7d37nsixp0Ft7sMHi8w="
|
||||
},
|
||||
"libjpeg-turbo": {
|
||||
"url": "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git",
|
||||
"rev": "24e310554f07c0fdb8ee52e3e708e4f3e9eb6e20",
|
||||
"sha256": "sha256-bhbUnA36rKYLJSLpElmXJqccXQDjjbMcNMsVM4Eekrs="
|
||||
},
|
||||
"icu": {
|
||||
"url": "https://chromium.googlesource.com/chromium/deps/icu.git",
|
||||
"rev": "a0718d4f121727e30b8d52c7a189ebf5ab52421f",
|
||||
"sha256": "sha256-BI3f/gf9GNDvSfXWeRHKBvznSz4mjXY8rM24kK7QvOM="
|
||||
},
|
||||
"zlib": {
|
||||
"url": "https://chromium.googlesource.com/chromium/src/third_party/zlib",
|
||||
"rev": "c876c8f87101c5a75f6014b0f832499afeb65b73",
|
||||
"sha256": "sha256-mwozVo8ymyrYN4tw+/ZnSI+xogSTZQ6PUBba/jQqRkE="
|
||||
},
|
||||
"harfbuzz": {
|
||||
"url": "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git",
|
||||
"rev": "3a74ee528255cc027d84b204a87b5c25e47bff79",
|
||||
"sha256": "sha256-/4UdoUj0bxj6+EfNE8ofjtWOn2VkseEfvdFah5rwwBM="
|
||||
},
|
||||
"libpng": {
|
||||
"url": "https://skia.googlesource.com/third_party/libpng.git",
|
||||
"rev": "386707c6d19b974ca2e3db7f5c61873813c6fe44",
|
||||
"sha256": "sha256-67kf5MBsnBBi0bOfX/RKL52xpaCWm/ampltAI+EeQ+c="
|
||||
},
|
||||
"libgifcodec": {
|
||||
"url": "https://skia.googlesource.com/libgifcodec",
|
||||
"rev": "fd59fa92a0c86788dcdd84d091e1ce81eda06a77",
|
||||
"sha256": "sha256-spyZU4QhV2xrHcBRoYqYgCR0wEM5lgfhGh8pqJE5yXM="
|
||||
}
|
||||
}
|
||||
7
pkgs/applications/editors/neovim/neovim-override.vim
Normal file
7
pkgs/applications/editors/neovim/neovim-override.vim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
" configuration generated by NIX
|
||||
set nocompatible
|
||||
|
||||
set packpath^=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vim-pack-dir
|
||||
set runtimepath^=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vim-pack-dir
|
||||
|
||||
:help ale
|
||||
44
pkgs/applications/editors/neovim/neovim-qt.nix
Normal file
44
pkgs/applications/editors/neovim/neovim-qt.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{ lib, mkDerivation, fetchFromGitHub, cmake, doxygen, makeWrapper
|
||||
, msgpack, neovim, python3Packages, qtbase, qtsvg }:
|
||||
|
||||
mkDerivation rec {
|
||||
pname = "neovim-qt-unwrapped";
|
||||
version = "0.2.16.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "equalsraf";
|
||||
repo = "neovim-qt";
|
||||
rev = "v${version}";
|
||||
sha256 = "0x5brrim3f21bzdmh6wyrhrislwpx1248wbx56csvic6v78hzqny";
|
||||
};
|
||||
|
||||
cmakeFlags = [
|
||||
"-DUSE_SYSTEM_MSGPACK=1"
|
||||
"-DENABLE_TESTS=0" # tests fail because xcb platform plugin is not found
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
neovim.unwrapped # only used to generate help tags at build time
|
||||
qtbase
|
||||
qtsvg
|
||||
] ++ (with python3Packages; [
|
||||
jinja2 python msgpack
|
||||
]);
|
||||
|
||||
nativeBuildInputs = [ cmake doxygen ];
|
||||
|
||||
preCheck = ''
|
||||
# The GUI tests require a running X server, disable them
|
||||
sed -i ../test/CMakeLists.txt -e '/^add_xtest_gui/d'
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Neovim client library and GUI, in Qt5";
|
||||
homepage = "https://github.com/equalsraf/neovim-qt";
|
||||
license = licenses.isc;
|
||||
maintainers = with maintainers; [ peterhoeg ];
|
||||
inherit (neovim.meta) platforms;
|
||||
};
|
||||
}
|
||||
44
pkgs/applications/editors/neovim/neovim-remote.nix
Normal file
44
pkgs/applications/editors/neovim/neovim-remote.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, python3
|
||||
, neovim
|
||||
}:
|
||||
|
||||
with python3.pkgs; buildPythonApplication rec {
|
||||
pname = "neovim-remote";
|
||||
version = "2.5.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mhinz";
|
||||
repo = "neovim-remote";
|
||||
rev = "v${version}";
|
||||
sha256 = "0lbz4w8hgxsw4k1pxafrl3rhydrvi5jc6vnsmkvnhh6l6rxlmvmq";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pynvim
|
||||
psutil
|
||||
setuptools
|
||||
];
|
||||
|
||||
checkInputs = [
|
||||
neovim
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
disabledTests = [
|
||||
# these tests get stuck and never return
|
||||
"test_escape_filenames_properly"
|
||||
"test_escape_single_quotes_in_filenames"
|
||||
"test_escape_double_quotes_in_filenames"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A tool that helps controlling nvim processes from a terminal";
|
||||
homepage = "https://github.com/mhinz/neovim-remote/";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ edanaher ];
|
||||
platforms = platforms.unix;
|
||||
mainProgram = "nvr";
|
||||
};
|
||||
}
|
||||
37
pkgs/applications/editors/neovim/qt.nix
Normal file
37
pkgs/applications/editors/neovim/qt.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ stdenv, makeWrapper, neovim, neovim-qt-unwrapped }:
|
||||
|
||||
let
|
||||
unwrapped = neovim-qt-unwrapped;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "neovim-qt";
|
||||
version = unwrapped.version;
|
||||
buildCommand = if stdenv.isDarwin then ''
|
||||
mkdir -p $out/Applications
|
||||
cp -r ${unwrapped}/bin/nvim-qt.app $out/Applications
|
||||
|
||||
chmod -R a+w $out/Applications/nvim-qt.app/Contents/MacOS
|
||||
wrapProgram $out/Applications/nvim-qt.app/Contents/MacOS/nvim-qt \
|
||||
--prefix PATH : ${neovim}/bin
|
||||
'' else ''
|
||||
makeWrapper ${unwrapped}/bin/nvim-qt $out/bin/nvim-qt \
|
||||
--prefix PATH : ${neovim}/bin
|
||||
|
||||
# link .desktop file
|
||||
mkdir -p $out/share/pixmaps
|
||||
ln -s ${unwrapped}/share/applications $out/share/applications
|
||||
ln -s ${unwrapped}/share/pixmaps/nvim-qt.png $out/share/pixmaps/nvim-qt.png
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
passthru = {
|
||||
inherit unwrapped;
|
||||
};
|
||||
|
||||
inherit (unwrapped) meta;
|
||||
}
|
||||
3
pkgs/applications/editors/neovim/ruby_provider/Gemfile
Normal file
3
pkgs/applications/editors/neovim/ruby_provider/Gemfile
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'neovim'
|
||||
17
pkgs/applications/editors/neovim/ruby_provider/Gemfile.lock
Normal file
17
pkgs/applications/editors/neovim/ruby_provider/Gemfile.lock
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
msgpack (1.5.1)
|
||||
multi_json (1.15.0)
|
||||
neovim (0.9.0)
|
||||
msgpack (~> 1.1)
|
||||
multi_json (~> 1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
neovim
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
33
pkgs/applications/editors/neovim/ruby_provider/gemset.nix
Normal file
33
pkgs/applications/editors/neovim/ruby_provider/gemset.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
msgpack = {
|
||||
groups = ["default"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "sha256-fPWiGi0w4OFlMZOIf3gd21jyeYhg5t/VdLz7kK9fD8Q=";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.5.1";
|
||||
};
|
||||
multi_json = {
|
||||
groups = ["default"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "sha256-H9BBOLbkqQAX6NG4BMA5AxOZhm/z+6u3girqNnx4YV0=";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.15.0";
|
||||
};
|
||||
neovim = {
|
||||
dependencies = ["msgpack" "multi_json"];
|
||||
groups = ["default"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "sha256-hRI43XGHGeqxMvpFjp0o79GGReiLXTkhwh5LYq6AQL4=";
|
||||
type = "gem";
|
||||
};
|
||||
version = "0.9.0";
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim
|
||||
index 6266b312b..965fabf1e 100644
|
||||
--- a/runtime/autoload/remote/host.vim
|
||||
+++ b/runtime/autoload/remote/host.vim
|
||||
@@ -71,7 +71,8 @@ function! remote#host#RegisterPlugin(host, path, specs) abort
|
||||
|
||||
for plugin in plugins
|
||||
if plugin.path == a:path
|
||||
- throw 'Plugin "'.a:path.'" is already registered'
|
||||
+ " plugin already registered
|
||||
+ return
|
||||
endif
|
||||
endfor
|
||||
|
||||
diff --git a/runtime/plugin/rplugin.vim b/runtime/plugin/rplugin.vim
|
||||
index 122d8d47f..83fbf8b57 100644
|
||||
--- a/runtime/plugin/rplugin.vim
|
||||
+++ b/runtime/plugin/rplugin.vim
|
||||
@@ -54,6 +54,10 @@ function! s:GetManifest() abort
|
||||
endfunction
|
||||
|
||||
function! s:LoadRemotePlugins() abort
|
||||
+ if exists('$NVIM_SYSTEM_RPLUGIN_MANIFEST')
|
||||
+ let g:system_remote_plugins = fnamemodify($NVIM_SYSTEM_RPLUGIN_MANIFEST, ':p')
|
||||
+ execute 'source' fnameescape(g:system_remote_plugins)
|
||||
+ endif
|
||||
let g:loaded_remote_plugins = s:GetManifest()
|
||||
if filereadable(g:loaded_remote_plugins)
|
||||
execute 'source' fnameescape(g:loaded_remote_plugins)
|
||||
174
pkgs/applications/editors/neovim/tests.nix
Normal file
174
pkgs/applications/editors/neovim/tests.nix
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
{ vimUtils, vim_configurable, writeText, neovim, vimPlugins
|
||||
, lib, fetchFromGitHub, neovimUtils, wrapNeovimUnstable
|
||||
, neovim-unwrapped
|
||||
, fetchFromGitLab
|
||||
, pkgs
|
||||
}:
|
||||
let
|
||||
inherit (vimUtils) buildVimPluginFrom2Nix;
|
||||
inherit (neovimUtils) makeNeovimConfig;
|
||||
|
||||
packages.myVimPackage.start = with vimPlugins; [ vim-nix ];
|
||||
|
||||
plugins = with vimPlugins; [
|
||||
{
|
||||
plugin = vim-obsession;
|
||||
config = ''
|
||||
map <Leader>$ <Cmd>Obsession<CR>
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
nvimConfNix = makeNeovimConfig {
|
||||
inherit plugins;
|
||||
customRC = ''
|
||||
" just a comment
|
||||
'';
|
||||
};
|
||||
|
||||
nvimAutoDisableWrap = makeNeovimConfig { };
|
||||
|
||||
nvimConfDontWrap = makeNeovimConfig {
|
||||
inherit plugins;
|
||||
customRC = ''
|
||||
" just a comment
|
||||
'';
|
||||
};
|
||||
|
||||
wrapNeovim2 = suffix: config:
|
||||
wrapNeovimUnstable neovim-unwrapped (config // {
|
||||
extraName = suffix;
|
||||
});
|
||||
|
||||
nmt = fetchFromGitLab {
|
||||
owner = "rycee";
|
||||
repo = "nmt";
|
||||
rev = "d2cc8c1042b1c2511f68f40e2790a8c0e29eeb42";
|
||||
sha256 = "1ykcvyx82nhdq167kbnpgwkgjib8ii7c92y3427v986n2s5lsskc";
|
||||
};
|
||||
|
||||
runTest = neovim-drv: buildCommand:
|
||||
pkgs.runCommandLocal "test-${neovim-drv.name}" ({
|
||||
nativeBuildInputs = [ ];
|
||||
meta.platforms = neovim-drv.meta.platforms;
|
||||
}) (''
|
||||
source ${nmt}/bash-lib/assertions.sh
|
||||
vimrc="${writeText "init.vim" neovim-drv.initRc}"
|
||||
vimrcGeneric="$out/patched.vim"
|
||||
mkdir $out
|
||||
${pkgs.perl}/bin/perl -pe "s|\Q$NIX_STORE\E/[a-z0-9]{32}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" < "$vimrc" > "$vimrcGeneric"
|
||||
'' + buildCommand);
|
||||
|
||||
in
|
||||
pkgs.recurseIntoAttrs (
|
||||
rec {
|
||||
vim_empty_config = vimUtils.vimrcFile { beforePlugins = ""; customRC = ""; };
|
||||
|
||||
### neovim tests
|
||||
##################
|
||||
nvim_with_plugins = wrapNeovim2 "-with-plugins" nvimConfNix;
|
||||
|
||||
nvim_via_override = neovim.override {
|
||||
extraName = "-via-override";
|
||||
configure = {
|
||||
packages.foo.start = [ vimPlugins.ale ];
|
||||
customRC = ''
|
||||
:help ale
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nvim_with_aliases = neovim.override {
|
||||
extraName = "-with-aliases";
|
||||
vimAlias = true;
|
||||
viAlias = true;
|
||||
};
|
||||
|
||||
nvim_with_plug = neovim.override {
|
||||
extraName = "-with-plug";
|
||||
configure.plug.plugins = with pkgs.vimPlugins; [
|
||||
(base16-vim.overrideAttrs(old: { pname = old.pname + "-unique-for-tests-please-dont-use"; }))
|
||||
];
|
||||
configure.customRC = ''
|
||||
color base16-tomorrow-night
|
||||
set background=dark
|
||||
'';
|
||||
};
|
||||
|
||||
run_nvim_with_plug = runTest nvim_with_plug ''
|
||||
export HOME=$TMPDIR
|
||||
${nvim_with_plug}/bin/nvim -i NONE -c 'color base16-tomorrow-night' +quit! -e
|
||||
'';
|
||||
|
||||
|
||||
# check that the vim-doc hook correctly generates the tag
|
||||
# we know for a fact packer has a doc folder
|
||||
checkForTags = vimPlugins.packer-nvim.overrideAttrs(oldAttrs: {
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
[ -f $out/doc/tags ]
|
||||
'';
|
||||
});
|
||||
|
||||
|
||||
# nixpkgs should detect that no wrapping is necessary
|
||||
nvimShouldntWrap = wrapNeovim2 "-should-not-wrap" nvimAutoDisableWrap;
|
||||
|
||||
# this will generate a neovimRc content but we disable wrapping
|
||||
nvimDontWrap = wrapNeovim2 "-forced-nowrap" (makeNeovimConfig {
|
||||
wrapRc = false;
|
||||
customRC = ''
|
||||
" this shouldn't trigger the creation of an init.vim
|
||||
'';
|
||||
});
|
||||
|
||||
force-nowrap = runTest nvimDontWrap ''
|
||||
! grep "-u" ${nvimDontWrap}/bin/nvim
|
||||
'';
|
||||
|
||||
nvim_via_override-test = runTest nvim_via_override ''
|
||||
assertFileContent \
|
||||
"$vimrcGeneric" \
|
||||
"${./neovim-override.vim}"
|
||||
'';
|
||||
|
||||
|
||||
checkAliases = runTest nvim_with_aliases ''
|
||||
folder=${nvim_with_aliases}/bin
|
||||
assertFileExists "$folder/vi"
|
||||
assertFileExists "$folder/vim"
|
||||
'';
|
||||
|
||||
# having no RC generated should autodisable init.vim wrapping
|
||||
nvim_autowrap = runTest nvim_via_override ''
|
||||
! grep "-u" ${nvimShouldntWrap}/bin/nvim
|
||||
'';
|
||||
|
||||
|
||||
# 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 {
|
||||
extraName = "-pathogen-remote";
|
||||
configure.pathogen.pluginNames = with vimPlugins; [ deoplete-nvim ];
|
||||
};
|
||||
|
||||
# only neovim makes use of `requiredPlugins`, test this here
|
||||
test_nvim_with_vim_nix_using_pathogen = neovim.override {
|
||||
extraName = "-pathogen";
|
||||
configure.pathogen.pluginNames = [ "vim-nix" ];
|
||||
};
|
||||
|
||||
nvimWithLuaPackages = wrapNeovim2 "-with-lua-packages" (makeNeovimConfig {
|
||||
extraLuaPackages = ps: [ps.mpack];
|
||||
customRC = ''
|
||||
lua require("mpack")
|
||||
'';
|
||||
});
|
||||
|
||||
nvim_with_lua_packages = runTest nvimWithLuaPackages ''
|
||||
export HOME=$TMPDIR
|
||||
${nvimWithLuaPackages}/bin/nvim -i NONE --noplugin -es
|
||||
'';
|
||||
})
|
||||
187
pkgs/applications/editors/neovim/utils.nix
Normal file
187
pkgs/applications/editors/neovim/utils.nix
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
{ lib
|
||||
, vimUtils
|
||||
, nodejs
|
||||
, neovim-unwrapped
|
||||
, bundlerEnv
|
||||
, ruby
|
||||
, python3Packages
|
||||
, writeText
|
||||
, wrapNeovimUnstable
|
||||
}:
|
||||
let
|
||||
# returns everything needed for the caller to wrap its own neovim:
|
||||
# - the generated content of the future init.vim
|
||||
# - the arguments to wrap neovim with
|
||||
# The caller is responsible for writing the init.vim and adding it to the wrapped
|
||||
# arguments (["-u" writeText "init.vim" GENERATEDRC)]).
|
||||
# This makes it possible to write the config anywhere: on a per-project basis
|
||||
# .nvimrc or in $XDG_CONFIG_HOME/nvim/init.vim to avoid sideeffects.
|
||||
# Indeed, note that wrapping with `-u init.vim` has sideeffects like .nvimrc wont be loaded
|
||||
# anymore, $MYVIMRC wont be set etc
|
||||
makeNeovimConfig =
|
||||
{
|
||||
withPython2 ? false
|
||||
/* the function you would have passed to python.withPackages */
|
||||
, extraPython2Packages ? (_: [ ])
|
||||
, withPython3 ? true
|
||||
/* the function you would have passed to python3.withPackages */
|
||||
, extraPython3Packages ? (_: [ ])
|
||||
, withNodeJs ? false
|
||||
, withRuby ? true
|
||||
/* the function you would have passed to lua.withPackages */
|
||||
, extraLuaPackages ? (_: [ ])
|
||||
|
||||
# expects a list of plugin configuration
|
||||
# expects { plugin=far-vim; config = "let g:far#source='rg'"; optional = false; }
|
||||
, plugins ? []
|
||||
# forwarded to configure.customRC
|
||||
, customRC ? ""
|
||||
# same values as in vimUtils.vimrcContent
|
||||
, configure ? { }
|
||||
|
||||
# for forward compability, when adding new environments, haskell etc.
|
||||
, ...
|
||||
}@args:
|
||||
let
|
||||
rubyEnv = bundlerEnv {
|
||||
name = "neovim-ruby-env";
|
||||
gemdir = ./ruby_provider;
|
||||
postBuild = ''
|
||||
ln -sf ${ruby}/bin/* $out/bin
|
||||
'';
|
||||
};
|
||||
|
||||
# transform all plugins into an attrset
|
||||
pluginsNormalized = map (x: if x ? plugin then { optional = false; } // x else { plugin = x; optional = false;}) plugins;
|
||||
|
||||
|
||||
configurePatched = configure // {
|
||||
customRC = pluginRc + customRC + (configure.customRC or "");
|
||||
};
|
||||
|
||||
# A function to get the configuration string (if any) from an element of 'plugins'
|
||||
pluginConfig = p:
|
||||
if (p.config or "") != "" then ''
|
||||
" ${p.plugin.pname or p.plugin.name} {{{
|
||||
${p.config}
|
||||
" }}}
|
||||
'' else "";
|
||||
|
||||
pluginRc = lib.concatMapStrings pluginConfig pluginsNormalized;
|
||||
|
||||
requiredPlugins = vimUtils.requiredPlugins configurePatched;
|
||||
getDeps = attrname: map (plugin: plugin.${attrname} or (_: [ ]));
|
||||
|
||||
pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins;
|
||||
python3Env = python3Packages.python.withPackages (ps:
|
||||
[ ps.pynvim ]
|
||||
++ (extraPython3Packages ps)
|
||||
++ (lib.concatMap (f: f ps) pluginPython3Packages));
|
||||
|
||||
luaEnv = neovim-unwrapped.lua.withPackages(extraLuaPackages);
|
||||
|
||||
# Mapping a boolean argument to a key that tells us whether to add or not to
|
||||
# add to nvim's 'embedded rc' this:
|
||||
# let g:<key>_host_prog=$out/bin/nvim-<key>
|
||||
# Or this:
|
||||
# let g:loaded_${prog}_provider=0
|
||||
# While the latter tells nvim that this provider is not available
|
||||
hostprog_check_table = {
|
||||
node = withNodeJs;
|
||||
python = false;
|
||||
python3 = withPython3;
|
||||
ruby = withRuby;
|
||||
};
|
||||
## Here we calculate all of the arguments to the 1st call of `makeWrapper`
|
||||
# We start with the executable itself NOTE we call this variable "initial"
|
||||
# because if configure != {} we need to call makeWrapper twice, in order to
|
||||
# avoid double wrapping, see comment near finalMakeWrapperArgs
|
||||
makeWrapperArgs =
|
||||
let
|
||||
binPath = lib.makeBinPath (lib.optionals withRuby [ rubyEnv ] ++ lib.optionals withNodeJs [ nodejs ]);
|
||||
|
||||
flags = lib.concatLists (lib.mapAttrsToList (
|
||||
prog: withProg: [
|
||||
"--cmd" (genProviderSettings prog withProg)
|
||||
]
|
||||
)
|
||||
hostprog_check_table);
|
||||
in
|
||||
[
|
||||
"--inherit-argv0" "--add-flags" (lib.escapeShellArgs flags)
|
||||
] ++ lib.optionals withRuby [
|
||||
"--set" "GEM_HOME" "${rubyEnv}/${rubyEnv.ruby.gemPath}"
|
||||
] ++ lib.optionals (binPath != "") [
|
||||
"--suffix" "PATH" ":" binPath
|
||||
] ++ lib.optionals (luaEnv != null) [
|
||||
"--prefix" "LUA_PATH" ";" (neovim-unwrapped.lua.pkgs.lib.genLuaPathAbsStr luaEnv)
|
||||
"--prefix" "LUA_CPATH" ";" (neovim-unwrapped.lua.pkgs.lib.genLuaCPathAbsStr luaEnv)
|
||||
];
|
||||
|
||||
|
||||
manifestRc = vimUtils.vimrcContent (configurePatched // { customRC = ""; }) ;
|
||||
neovimRcContent = vimUtils.vimrcContent configurePatched;
|
||||
in
|
||||
assert withPython2 -> throw "Python2 support has been removed from neovim, please remove withPython2 and extraPython2Packages.";
|
||||
|
||||
builtins.removeAttrs args ["plugins"] // {
|
||||
wrapperArgs = makeWrapperArgs;
|
||||
inherit neovimRcContent;
|
||||
inherit manifestRc;
|
||||
inherit python3Env;
|
||||
inherit luaEnv;
|
||||
inherit withNodeJs;
|
||||
} // lib.optionalAttrs withRuby {
|
||||
inherit rubyEnv;
|
||||
};
|
||||
|
||||
genProviderSettings = prog: withProg:
|
||||
if withProg then
|
||||
"let g:${prog}_host_prog='${placeholder "out"}/bin/nvim-${prog}'"
|
||||
else
|
||||
"let g:loaded_${prog}_provider=0"
|
||||
;
|
||||
|
||||
# to keep backwards compatibility
|
||||
legacyWrapper = neovim: {
|
||||
extraMakeWrapperArgs ? ""
|
||||
, withPython ? false
|
||||
/* the function you would have passed to python.withPackages */
|
||||
, extraPythonPackages ? (_: [])
|
||||
/* the function you would have passed to python.withPackages */
|
||||
, withPython3 ? true, extraPython3Packages ? (_: [])
|
||||
/* the function you would have passed to lua.withPackages */
|
||||
, extraLuaPackages ? (_: [])
|
||||
, withNodeJs ? false
|
||||
, withRuby ? true
|
||||
, vimAlias ? false
|
||||
, viAlias ? false
|
||||
, configure ? {}
|
||||
, extraName ? ""
|
||||
}:
|
||||
let
|
||||
/* for compatibility with passing extraPythonPackages as a list; added 2018-07-11 */
|
||||
compatFun = funOrList: (if builtins.isList funOrList then
|
||||
(_: lib.warn "passing a list as extraPythonPackages to the neovim wrapper is deprecated, pass a function as to python.withPackages instead" funOrList)
|
||||
else funOrList);
|
||||
|
||||
res = makeNeovimConfig {
|
||||
inherit withPython3;
|
||||
extraPython3Packages = compatFun extraPython3Packages;
|
||||
inherit extraLuaPackages;
|
||||
inherit withNodeJs withRuby viAlias vimAlias;
|
||||
inherit configure;
|
||||
inherit extraName;
|
||||
};
|
||||
in
|
||||
assert withPython -> throw "Python2 support has been removed from neovim, please remove withPython and extraPythonPackages.";
|
||||
|
||||
wrapNeovimUnstable neovim (res // {
|
||||
wrapperArgs = lib.escapeShellArgs res.wrapperArgs + " " + extraMakeWrapperArgs;
|
||||
wrapRc = (configure != {});
|
||||
});
|
||||
in
|
||||
{
|
||||
inherit makeNeovimConfig;
|
||||
inherit legacyWrapper;
|
||||
}
|
||||
138
pkgs/applications/editors/neovim/wrapper.nix
Normal file
138
pkgs/applications/editors/neovim/wrapper.nix
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
{ stdenv, symlinkJoin, lib, makeWrapper
|
||||
, writeText
|
||||
, bundlerEnv, ruby
|
||||
, nodejs
|
||||
, nodePackages
|
||||
, python3
|
||||
, python3Packages
|
||||
, callPackage
|
||||
}:
|
||||
with lib;
|
||||
|
||||
neovim:
|
||||
|
||||
let
|
||||
wrapper = {
|
||||
extraName ? ""
|
||||
# should contain all args but the binary. Can be either a string or list
|
||||
, wrapperArgs ? []
|
||||
, manifestRc ? null
|
||||
, withPython2 ? false
|
||||
, withPython3 ? true, python3Env ? python3
|
||||
, withNodeJs ? false
|
||||
, rubyEnv ? null
|
||||
, vimAlias ? false
|
||||
, viAlias ? false
|
||||
|
||||
# additional argument not generated by makeNeovimConfig
|
||||
# it will append "-u <customRc>" to the wrapped arguments
|
||||
# set to false if you want to control where to save the generated config
|
||||
# (e.g., in ~/.config/init.vim or project/.nvimrc)
|
||||
, wrapRc ? true
|
||||
, neovimRcContent ? ""
|
||||
, ...
|
||||
}@args:
|
||||
let
|
||||
|
||||
wrapperArgsStr = if isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs;
|
||||
|
||||
# If configure != {}, we can't generate the rplugin.vim file with e.g
|
||||
# NVIM_SYSTEM_RPLUGIN_MANIFEST *and* NVIM_RPLUGIN_MANIFEST env vars set in
|
||||
# the wrapper. That's why only when configure != {} (tested both here and
|
||||
# when postBuild is evaluated), we call makeWrapper once to generate a
|
||||
# wrapper with most arguments we need, excluding those that cause problems to
|
||||
# generate rplugin.vim, but still required for the final wrapper.
|
||||
finalMakeWrapperArgs =
|
||||
[ "${neovim}/bin/nvim" "${placeholder "out"}/bin/nvim" ]
|
||||
++ [ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ]
|
||||
++ optionals wrapRc [ "--add-flags" "-u ${writeText "init.vim" neovimRcContent}" ]
|
||||
;
|
||||
in
|
||||
assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env.";
|
||||
|
||||
symlinkJoin {
|
||||
name = "neovim-${lib.getVersion neovim}${extraName}";
|
||||
# Remove the symlinks created by symlinkJoin which we need to perform
|
||||
# extra actions upon
|
||||
postBuild = lib.optionalString stdenv.isLinux ''
|
||||
rm $out/share/applications/nvim.desktop
|
||||
substitute ${neovim}/share/applications/nvim.desktop $out/share/applications/nvim.desktop \
|
||||
--replace 'Name=Neovim' 'Name=WrappedNeovim'
|
||||
''
|
||||
+ optionalString withPython3 ''
|
||||
makeWrapper ${python3Env.interpreter} $out/bin/nvim-python3 --unset PYTHONPATH
|
||||
''
|
||||
+ optionalString (rubyEnv != null) ''
|
||||
ln -s ${rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby
|
||||
''
|
||||
+ optionalString withNodeJs ''
|
||||
ln -s ${nodePackages.neovim}/bin/neovim-node-host $out/bin/nvim-node
|
||||
''
|
||||
+ optionalString vimAlias ''
|
||||
ln -s $out/bin/nvim $out/bin/vim
|
||||
''
|
||||
+ optionalString viAlias ''
|
||||
ln -s $out/bin/nvim $out/bin/vi
|
||||
''
|
||||
+ optionalString (manifestRc != null) (let
|
||||
manifestWrapperArgs =
|
||||
[ "${neovim}/bin/nvim" "${placeholder "out"}/bin/nvim-wrapper" ];
|
||||
in ''
|
||||
echo "Generating remote plugin manifest"
|
||||
export NVIM_RPLUGIN_MANIFEST=$out/rplugin.vim
|
||||
makeWrapper ${lib.escapeShellArgs manifestWrapperArgs} ${wrapperArgsStr}
|
||||
|
||||
# Some plugins assume that the home directory is accessible for
|
||||
# initializing caches, temporary files, etc. Even if the plugin isn't
|
||||
# actively used, it may throw an error as soon as Neovim is launched
|
||||
# (e.g., inside an autoload script), causing manifest generation to
|
||||
# fail. Therefore, let's create a fake home directory before generating
|
||||
# the manifest, just to satisfy the needs of these plugins.
|
||||
#
|
||||
# See https://github.com/Yggdroot/LeaderF/blob/v1.21/autoload/lfMru.vim#L10
|
||||
# for an example of this behavior.
|
||||
export HOME="$(mktemp -d)"
|
||||
# Launch neovim with a vimrc file containing only the generated plugin
|
||||
# code. Pass various flags to disable temp file generation
|
||||
# (swap/viminfo) and redirect errors to stderr.
|
||||
# Only display the log on error since it will contain a few normally
|
||||
# irrelevant messages.
|
||||
if ! $out/bin/nvim-wrapper \
|
||||
-u ${writeText "manifest.vim" manifestRc} \
|
||||
-i NONE -n \
|
||||
-E -V1rplugins.log -s \
|
||||
+UpdateRemotePlugins +quit! > outfile 2>&1; then
|
||||
cat outfile
|
||||
echo -e "\nGenerating rplugin.vim failed!"
|
||||
exit 1
|
||||
fi
|
||||
rm "${placeholder "out"}/bin/nvim-wrapper"
|
||||
'')
|
||||
+ ''
|
||||
rm $out/bin/nvim
|
||||
touch $out/rplugin.vim
|
||||
makeWrapper ${lib.escapeShellArgs finalMakeWrapperArgs} ${wrapperArgsStr}
|
||||
'';
|
||||
|
||||
paths = [ neovim ];
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
passthru = {
|
||||
unwrapped = neovim;
|
||||
initRc = neovimRcContent;
|
||||
|
||||
tests = callPackage ./tests.nix {
|
||||
};
|
||||
};
|
||||
|
||||
meta = neovim.meta // {
|
||||
# To prevent builds on hydra
|
||||
hydraPlatforms = [];
|
||||
# prefer wrapper over the package
|
||||
priority = (neovim.meta.priority or 0) - 1;
|
||||
};
|
||||
};
|
||||
in
|
||||
lib.makeOverridable wrapper
|
||||
Loading…
Add table
Add a link
Reference in a new issue