2020-12-09 01:15:37 -07:00
|
|
|
{
|
|
|
|
description = "Neovim flake";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2021-01-05 13:12:21 -07:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2020-12-09 01:15:37 -07:00
|
|
|
};
|
|
|
|
|
2021-01-05 13:12:21 -07:00
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
|
|
{
|
2022-12-28 06:26:59 -07:00
|
|
|
overlay = final: prev: {
|
2022-09-30 10:25:12 -07:00
|
|
|
|
|
|
|
neovim = final.neovim-unwrapped.overrideAttrs (oa: {
|
|
|
|
version = "master";
|
|
|
|
src = ../.;
|
|
|
|
});
|
|
|
|
|
|
|
|
# a development binary to help debug issues
|
|
|
|
neovim-debug = let
|
|
|
|
stdenv = if final.stdenv.isLinux then
|
|
|
|
final.llvmPackages_latest.stdenv
|
|
|
|
else
|
|
|
|
final.stdenv;
|
2022-12-28 06:26:59 -07:00
|
|
|
in (final.neovim.override {
|
2022-09-30 10:25:12 -07:00
|
|
|
lua = final.luajit;
|
|
|
|
inherit stdenv;
|
|
|
|
}).overrideAttrs (oa: {
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
NIX_CFLAGS_COMPILE = " -ggdb -Og";
|
|
|
|
|
|
|
|
cmakeBuildType = "Debug";
|
|
|
|
cmakeFlags = oa.cmakeFlags ++ [ "-DMIN_LOG_LEVEL=0" ];
|
|
|
|
|
|
|
|
disallowedReferences = [ ];
|
2022-12-28 06:26:59 -07:00
|
|
|
});
|
2022-09-30 10:25:12 -07:00
|
|
|
|
|
|
|
# for neovim developers, beware of the slow binary
|
2022-12-28 06:26:59 -07:00
|
|
|
neovim-developer = let inherit (final.luaPackages) luacheck;
|
|
|
|
in (final.neovim-debug.override {
|
2022-09-30 10:25:12 -07:00
|
|
|
doCheck = final.stdenv.isLinux;
|
2022-12-28 06:26:59 -07:00
|
|
|
}).overrideAttrs (oa: {
|
2022-09-30 10:25:12 -07:00
|
|
|
cmakeFlags = oa.cmakeFlags ++ [
|
|
|
|
"-DLUACHECK_PRG=${luacheck}/bin/luacheck"
|
|
|
|
"-DMIN_LOG_LEVEL=0"
|
|
|
|
"-DENABLE_LTO=OFF"
|
|
|
|
] ++ final.lib.optionals final.stdenv.isLinux [
|
|
|
|
# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
|
|
|
|
# https://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports
|
|
|
|
"-DCLANG_ASAN_UBSAN=ON"
|
|
|
|
];
|
|
|
|
});
|
|
|
|
};
|
|
|
|
} // flake-utils.lib.eachDefaultSystem (system:
|
2021-01-05 13:12:21 -07:00
|
|
|
let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
overlays = [ self.overlay ];
|
|
|
|
inherit system;
|
|
|
|
};
|
2021-07-10 08:48:59 -07:00
|
|
|
|
2022-09-02 15:13:39 -07:00
|
|
|
lua = pkgs.lua5_1;
|
|
|
|
|
|
|
|
pythonEnv = pkgs.python3.withPackages (ps: [
|
2021-07-10 08:48:59 -07:00
|
|
|
ps.msgpack
|
|
|
|
]);
|
2022-09-30 10:25:12 -07:00
|
|
|
in {
|
2021-01-05 13:12:21 -07:00
|
|
|
packages = with pkgs; {
|
2022-09-05 02:41:42 -07:00
|
|
|
default = neovim;
|
2021-01-05 13:12:21 -07:00
|
|
|
inherit neovim neovim-debug neovim-developer;
|
|
|
|
};
|
2020-12-09 01:15:37 -07:00
|
|
|
|
2021-07-10 08:48:59 -07:00
|
|
|
checks = {
|
2022-09-30 10:25:12 -07:00
|
|
|
shlint = pkgs.runCommand "shlint" {
|
|
|
|
nativeBuildInputs = [ pkgs.shellcheck ];
|
|
|
|
preferLocalBuild = true;
|
|
|
|
} "make -C ${./..} shlint > $out";
|
2021-07-10 08:48:59 -07:00
|
|
|
};
|
|
|
|
|
2022-09-05 02:41:42 -07:00
|
|
|
# kept for backwards-compatibility
|
2021-01-05 13:12:21 -07:00
|
|
|
defaultPackage = pkgs.neovim;
|
2020-12-09 01:15:37 -07:00
|
|
|
|
2022-09-02 15:13:39 -07:00
|
|
|
devShells = {
|
|
|
|
default = pkgs.neovim-developer.overrideAttrs (oa: {
|
|
|
|
|
2022-09-30 10:25:12 -07:00
|
|
|
buildInputs = with pkgs;
|
|
|
|
oa.buildInputs ++ [
|
|
|
|
cmake
|
|
|
|
lua.pkgs.luacheck
|
|
|
|
sumneko-lua-language-server
|
|
|
|
pythonEnv
|
|
|
|
include-what-you-use # for scripts/check-includes.py
|
|
|
|
jq # jq for scripts/vim-patch.sh -r
|
|
|
|
shellcheck # for `make shlint`
|
|
|
|
doxygen # for script/gen_vimdoc.py
|
|
|
|
clang-tools # for clangd to find the correct headers
|
|
|
|
];
|
2021-07-10 08:48:59 -07:00
|
|
|
|
2022-09-02 15:13:39 -07:00
|
|
|
shellHook = oa.shellHook + ''
|
|
|
|
export NVIM_PYTHON_LOG_LEVEL=DEBUG
|
|
|
|
export NVIM_LOG_FILE=/tmp/nvim.log
|
|
|
|
export ASAN_SYMBOLIZER_PATH=${pkgs.llvm_11}/bin/llvm-symbolizer
|
|
|
|
|
|
|
|
# ASAN_OPTIONS=detect_leaks=1
|
|
|
|
export ASAN_OPTIONS="log_path=./test.log:abort_on_error=1"
|
|
|
|
export UBSAN_OPTIONS=print_stacktrace=1
|
|
|
|
|
|
|
|
# for treesitter functionaltests
|
|
|
|
mkdir -p runtime/parser
|
2022-12-28 06:26:59 -07:00
|
|
|
cp -f ${pkgs.vimPlugins.nvim-treesitter.builtGrammars.c}/parser runtime/parser/c.so
|
2022-09-02 15:13:39 -07:00
|
|
|
'';
|
|
|
|
});
|
|
|
|
};
|
|
|
|
});
|
2020-12-09 01:15:37 -07:00
|
|
|
}
|