Merge pull request #20091 from teto/fix-flake

This commit is contained in:
Matthieu Coudron 2022-09-12 14:07:44 +02:00 committed by GitHub
commit add27f2898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 68 deletions

View File

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1644229661, "lastModified": 1659877975,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -17,11 +17,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1646254136, "lastModified": 1662019588,
"narHash": "sha256-8nQx02tTzgYO21BP/dy5BCRopE8OwE8Drsw98j+Qoaw=", "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3e072546ea98db00c2364b81491b893673267827", "rev": "2da64a81275b68fdad38af669afeda43d401e94b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -23,24 +23,25 @@
}); });
# a development binary to help debug issues # a development binary to help debug issues
neovim-debug = let neovim-debug =
stdenv = if pkgs.stdenv.isLinux then pkgs.llvmPackages_latest.stdenv else pkgs.stdenv; let
in stdenv = if pkgs.stdenv.isLinux then pkgs.llvmPackages_latest.stdenv else pkgs.stdenv;
in
((neovim.override { ((neovim.override {
lua = pkgs.luajit; lua = pkgs.luajit;
inherit stdenv; inherit stdenv;
}).overrideAttrs (oa: { }).overrideAttrs (oa: {
dontStrip = true; dontStrip = true;
NIX_CFLAGS_COMPILE = " -ggdb -Og"; NIX_CFLAGS_COMPILE = " -ggdb -Og";
cmakeBuildType = "Debug"; cmakeBuildType = "Debug";
cmakeFlags = oa.cmakeFlags ++ [ cmakeFlags = oa.cmakeFlags ++ [
"-DMIN_LOG_LEVEL=0" "-DMIN_LOG_LEVEL=0"
]; ];
disallowedReferences = []; disallowedReferences = [ ];
})); }));
# for neovim developers, beware of the slow binary # for neovim developers, beware of the slow binary
neovim-developer = neovim-developer =
@ -68,70 +69,71 @@
inherit system; inherit system;
}; };
pythonEnv = pkgs.python3.withPackages(ps: [ lua = pkgs.lua5_1;
pythonEnv = pkgs.python3.withPackages (ps: [
ps.msgpack ps.msgpack
ps.flake8 # for 'make pylint' ps.flake8 # for 'make pylint'
]); ]);
in in
rec { rec {
packages = with pkgs; { packages = with pkgs; {
default = neovim;
inherit neovim neovim-debug neovim-developer; inherit neovim neovim-debug neovim-developer;
}; };
checks = { checks = {
pylint = pkgs.runCommandNoCC "pylint" { pylint = pkgs.runCommandNoCC "pylint"
nativeBuildInputs = [ pythonEnv ]; {
preferLocalBuild = true; nativeBuildInputs = [ pythonEnv ];
preferLocalBuild = true;
} "make -C ${./..} pylint > $out"; } "make -C ${./..} pylint > $out";
shlint = pkgs.runCommandNoCC "shlint" { shlint = pkgs.runCommandNoCC "shlint"
nativeBuildInputs = [ pkgs.shellcheck ]; {
preferLocalBuild = true; nativeBuildInputs = [ pkgs.shellcheck ];
preferLocalBuild = true;
} "make -C ${./..} shlint > $out"; } "make -C ${./..} shlint > $out";
}; };
# kept for backwards-compatibility
defaultPackage = pkgs.neovim; defaultPackage = pkgs.neovim;
apps = { devShells = {
nvim = flake-utils.lib.mkApp { drv = pkgs.neovim; name = "nvim"; }; default = pkgs.neovim-developer.overrideAttrs (oa: {
nvim-debug = flake-utils.lib.mkApp { drv = pkgs.neovim-debug; name = "nvim"; };
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
];
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
mkdir -p build/runtime/parser
# nvim looks into CMAKE_INSTALL_DIR. Hack to avoid errors
# when running the functionaltests
mkdir -p outputs/out/share/nvim/syntax
touch outputs/out/share/nvim/syntax/syntax.vim
# for treesitter functionaltests
mkdir -p runtime/parser
cp -f ${pkgs.tree-sitter.builtGrammars.tree-sitter-c}/parser runtime/parser/c.so
'';
});
}; };
});
defaultApp = apps.nvim;
devShell = let
in
pkgs.neovim-developer.overrideAttrs(oa: {
buildInputs = with pkgs; oa.buildInputs ++ [
cmake
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
];
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
mkdir -p build/runtime/parser
# nvim looks into CMAKE_INSTALL_DIR. Hack to avoid errors
# when running the functionaltests
mkdir -p outputs/out/share/nvim/syntax
touch outputs/out/share/nvim/syntax/syntax.vim
# for treesitter functionaltests
mkdir -p runtime/parser
cp -f ${pkgs.tree-sitter.builtGrammars.tree-sitter-c}/parser runtime/parser/c.so
'';
});
});
} }