diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2024-05-05 14:20:07 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2024-05-05 14:50:32 +0200 |
commit | 100509c030faf7cca1582c5a7197b8d3a815d600 (patch) | |
tree | d55f8944fd90a3dd0d86e0f495f3d0bbdf795060 /pkgs/by-name/ne | |
parent | 5434ca3ba0d0db2de14cfb9a0818ea8718f696ad (diff) | |
parent | 5dc079ed333c755fe000f2b86e97bf11f6f069a4 (diff) |
Merge branch 'staging-next' into staging
Conflicts in luaPackages.luarocks-nix: - 8b563cd9f923cdf009b3864a358d912103703320 switched to the new version format (prefixed by 0 since there was no relevant last tag in the branch). bc4f6fa54321533b250984f7b3813f8d343dfde1 bumped version and switched to the new version format. But the tag used is not part of the branch the commit comes from (master). Used the new version but replaced the tag prefix with 0. - b73ec84b9eed8de7e9095e779ee3d4066ceb091e removed meta (it is already set in the overridden luarocks). But that would cause the update script to try to update the overridden luarocks (as did the previously used old.meta). bf311d950e4c5d65fae66717c7c3d4f085ff6415 modified meta to fix the update script properly. Kept the meta from the latter since it allows update script to work.
Diffstat (limited to 'pkgs/by-name/ne')
-rw-r--r-- | pkgs/by-name/ne/neovide/package.nix | 119 | ||||
-rw-r--r-- | pkgs/by-name/ne/neovide/skia-externals.json | 37 | ||||
-rw-r--r-- | pkgs/by-name/ne/neovim-unwrapped/package.nix | 209 | ||||
-rw-r--r-- | pkgs/by-name/ne/neovim-unwrapped/system_rplugin_manifest.patch | 29 | ||||
-rw-r--r-- | pkgs/by-name/ne/neovim-unwrapped/treesitter-parsers.nix | 24 | ||||
-rwxr-xr-x | pkgs/by-name/ne/neovim-unwrapped/update-treesitter-parsers.py | 46 | ||||
-rw-r--r-- | pkgs/by-name/ne/netscanner/package.nix | 6 |
7 files changed, 467 insertions, 3 deletions
diff --git a/pkgs/by-name/ne/neovide/package.nix b/pkgs/by-name/ne/neovide/package.nix new file mode 100644 index 0000000000000..ce9b091add820 --- /dev/null +++ b/pkgs/by-name/ne/neovide/package.nix @@ -0,0 +1,119 @@ +{ lib +, rustPlatform +, clangStdenv +, fetchFromGitHub +, linkFarm +, fetchgit +, runCommand +, gn +, neovim +, ninja +, makeWrapper +, pkg-config +, python3 +, removeReferencesTo +, xcbuild +, SDL2 +, fontconfig +, xorg +, stdenv +, darwin +, libglvnd +, libxkbcommon +, enableWayland ? stdenv.isLinux +, wayland +}: + +rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec { + pname = "neovide"; + version = "0.12.2"; + + src = fetchFromGitHub { + owner = "neovide"; + repo = "neovide"; + rev = version; + sha256 = "sha256-M19LKNjUmC0WkVGm4t7vjxgMMe0FdMTmB1mLcG33OUg="; + }; + + cargoHash = "sha256-2fPprZVT7V+Ot8aCpWj6WTdyFylmzlujFdTJCrtE0rk="; + + SKIA_SOURCE_DIR = + let + repo = fetchFromGitHub { + owner = "rust-skia"; + repo = "skia"; + # see rust-skia:skia-bindings/Cargo.toml#package.metadata skia + rev = "m119-0.67.3"; + sha256 = "sha256-U75NuJnQa5+SNlOrsBmdlvflGdjo3el63EeIsbnE7ms="; + }; + # The externals for skia are taken from skia/DEPS + externals = linkFarm "skia-externals" (lib.mapAttrsToList + (name: value: { inherit name; path = fetchgit value; }) + (lib.importJSON ./skia-externals.json)); + in + runCommand "source" { } '' + cp -R ${repo} $out + chmod -R +w $out + ln -s ${externals} $out/third_party/externals + '' + ; + + SKIA_GN_COMMAND = "${gn}/bin/gn"; + SKIA_NINJA_COMMAND = "${ninja}/bin/ninja"; + + nativeBuildInputs = [ + makeWrapper + pkg-config + python3 # skia + removeReferencesTo + ] ++ lib.optionals stdenv.isDarwin [ xcbuild ]; + + nativeCheckInputs = [ neovim ]; + + buildInputs = [ + SDL2 + fontconfig + rustPlatform.bindgenHook + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.AppKit + ]; + + postFixup = let + libPath = lib.makeLibraryPath ([ + libglvnd + libxkbcommon + xorg.libXcursor + xorg.libXext + xorg.libXrandr + xorg.libXi + ] ++ lib.optionals enableWayland [ wayland ]); + in '' + # library skia embeds the path to its sources + remove-references-to -t "$SKIA_SOURCE_DIR" \ + $out/bin/neovide + + 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 + ''; + + disallowedReferences = [ SKIA_SOURCE_DIR ]; + + meta = with lib; { + description = "This is a simple graphical user interface for Neovim."; + mainProgram = "neovide"; + homepage = "https://github.com/neovide/neovide"; + changelog = "https://github.com/neovide/neovide/releases/tag/${version}"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ ck3d ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/by-name/ne/neovide/skia-externals.json b/pkgs/by-name/ne/neovide/skia-externals.json new file mode 100644 index 0000000000000..e57814e2a2d87 --- /dev/null +++ b/pkgs/by-name/ne/neovide/skia-externals.json @@ -0,0 +1,37 @@ +{ + "expat": { + "url": "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git", + "rev": "441f98d02deafd9b090aea568282b28f66a50e36", + "sha256": "sha256-FXTDGAK03jc2wvazhRKqtsFRKZUYS/9HLpZNp4JfZJI=" + }, + "libjpeg-turbo": { + "url": "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git", + "rev": "ed683925e4897a84b3bffc5c1414c85b97a129a3", + "sha256": "sha256-DYJP3phe4OzCtRN2pMc07ITTWR8MuIlOWWg9PBsQAVw=" + }, + "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": "4cfc6d8e173e800df086d7be078da2e8c5cfca19", + "sha256": "sha256-rrstyAz7Eb8ZgFJZKUASY8nU4YFZAptd5VS9B2cs2Yg=" + }, + "wuffs": { + "url": "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git", + "rev": "e3f919ccfe3ef542cfc983a82146070258fb57f8", + "sha256": "sha256-373d2F/STcgCHEq+PO+SCHrKVOo6uO1rqqwRN5eeBCw=" + }, + "libpng": { + "url": "https://skia.googlesource.com/third_party/libpng.git", + "rev": "386707c6d19b974ca2e3db7f5c61873813c6fe44", + "sha256": "sha256-67kf5MBsnBBi0bOfX/RKL52xpaCWm/ampltAI+EeQ+c=" + } +} diff --git a/pkgs/by-name/ne/neovim-unwrapped/package.nix b/pkgs/by-name/ne/neovim-unwrapped/package.nix new file mode 100644 index 0000000000000..0dd8ca8a0877b --- /dev/null +++ b/pkgs/by-name/ne/neovim-unwrapped/package.nix @@ -0,0 +1,209 @@ +{ lib, stdenv, fetchFromGitHub, removeReferencesTo, cmake, gettext, msgpack-c, libtermkey, libiconv +, libuv, lua, ncurses, pkg-config +, unibilium, gperf +, libvterm-neovim +, tree-sitter +, fetchurl +, buildPackages +, treesitter-parsers ? import ./treesitter-parsers.nix { inherit fetchurl; } +, CoreServices +, fixDarwinDylibNames +, 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 +, nodejs ? null, fish ? null, python3 ? null +}: +stdenv.mkDerivation (finalAttrs: + let + nvim-lpeg-dylib = luapkgs: if stdenv.isDarwin + then (luapkgs.lpeg.overrideAttrs (oa: { + preConfigure = '' + # neovim wants clang .dylib + sed -i makefile -e "s/CC = gcc/CC = clang/" + sed -i makefile -e "s/-bundle/-dynamiclib/" + ''; + preBuild = '' + # there seems to be implicit calls to Makefile from luarocks, we need to + # add a stage to build our dylib + make macosx + mkdir -p $out/lib + mv lpeg.so $out/lib/lpeg.dylib + ''; + nativeBuildInputs = + oa.nativeBuildInputs + ++ ( + lib.optional stdenv.isDarwin fixDarwinDylibNames + ); + })) + else luapkgs.lpeg; + requiredLuaPkgs = ps: (with ps; [ + (nvim-lpeg-dylib ps) + luabitop + mpack + ] ++ lib.optionals finalAttrs.doCheck [ + luv + coxpcall + busted + luafilesystem + penlight + inspect + ] + ); + neovimLuaEnv = lua.withPackages requiredLuaPkgs; + neovimLuaEnvOnBuild = lua.luaOnBuild.withPackages requiredLuaPkgs; + codegenLua = + if lua.luaOnBuild.pkgs.isLuaJIT + then + let deterministicLuajit = + lua.luaOnBuild.override { + deterministicStringIds = true; + self = deterministicLuajit; + }; + in deterministicLuajit.withPackages(ps: [ ps.mpack (nvim-lpeg-dylib ps) ]) + else lua.luaOnBuild; + + +in { + pname = "neovim-unwrapped"; + version = "0.9.5"; + + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "neovim"; + repo = "neovim"; + rev = "v${finalAttrs.version}"; + hash = "sha256-CcaBqA0yFCffNPmXOJTo8c9v1jrEBiqAl8CG5Dj5YxE="; + }; + + 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 treesitter-parsers; + + 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-c + ncurses + neovimLuaEnv + tree-sitter + unibilium + ] ++ lib.optionals stdenv.isDarwin [ libiconv CoreServices ] + ++ lib.optionals finalAttrs.doCheck [ glibcLocales procps ] + ; + + doCheck = false; + + # to be exhaustive, one could run + # make oldtests too + checkPhase = '' + runHook preCheck + make functionaltest + runHook postCheck + ''; + + nativeBuildInputs = [ + cmake + gettext + pkg-config + removeReferencesTo + ]; + + # extra programs test via `make functionaltest` + nativeCheckInputs = let + pyEnv = python3.withPackages(ps: with ps; [ pynvim msgpack ]); + in [ + 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 ""; + '' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + sed -i runtime/CMakeLists.txt \ + -e "s|\".*/bin/nvim|\${stdenv.hostPlatform.emulator buildPackages} &|g" + sed -i src/nvim/po/CMakeLists.txt \ + -e "s|\$<TARGET_FILE:nvim|\${stdenv.hostPlatform.emulator buildPackages} &|g" + ''; + postInstall = '' + find "$out" -type f -exec remove-references-to -t ${stdenv.cc} '{}' + + ''; + # check that the above patching actually works + disallowedRequisites = [ stdenv.cc ] ++ lib.optional (lua != codegenLua) codegenLua; + + cmakeFlagsArray = [ + # 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" + ] + ++ lib.optional (!lua.pkgs.isLuaJIT) "-DPREFER_LUA=ON" + ; + + preConfigure = lib.optionalString lua.pkgs.isLuaJIT '' + cmakeFlagsArray+=( + "-DLUAC_PRG=${codegenLua}/bin/luajit -b -s %s -" + "-DLUA_GEN_PRG=${codegenLua}/bin/luajit" + "-DLUA_PRG=${neovimLuaEnvOnBuild}/bin/luajit" + ) + '' + lib.optionalString stdenv.isDarwin '' + substituteInPlace src/nvim/CMakeLists.txt --replace " util" "" + '' + '' + mkdir -p $out/lib/nvim/parser + '' + lib.concatStrings (lib.mapAttrsToList + (language: src: '' + ln -s \ + ${tree-sitter.buildGrammar { + inherit language src; + version = "neovim-${finalAttrs.version}"; + }}/parser \ + $out/lib/nvim/parser/${language}.so + '') + finalAttrs.treesitter-parsers); + + shellHook='' + export VIMRUNTIME=$PWD/runtime + ''; + + separateDebugInfo = true; + + meta = with lib; { + 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 ]; + platforms = platforms.unix; + }; + }) diff --git a/pkgs/by-name/ne/neovim-unwrapped/system_rplugin_manifest.patch b/pkgs/by-name/ne/neovim-unwrapped/system_rplugin_manifest.patch new file mode 100644 index 0000000000000..f634d3ec056a2 --- /dev/null +++ b/pkgs/by-name/ne/neovim-unwrapped/system_rplugin_manifest.patch @@ -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) diff --git a/pkgs/by-name/ne/neovim-unwrapped/treesitter-parsers.nix b/pkgs/by-name/ne/neovim-unwrapped/treesitter-parsers.nix new file mode 100644 index 0000000000000..d36f8bda85429 --- /dev/null +++ b/pkgs/by-name/ne/neovim-unwrapped/treesitter-parsers.nix @@ -0,0 +1,24 @@ +{ fetchurl }: + +{ + c = fetchurl { + url = "https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz"; + hash = "sha256:af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2"; + }; + lua = fetchurl { + url = "https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.14.tar.gz"; + hash = "sha256:930d0370dc15b66389869355c8e14305b9ba7aafd36edbfdb468c8023395016d"; + }; + vim = fetchurl { + url = "https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz"; + hash = "sha256:403acec3efb7cdb18ff3d68640fc823502a4ffcdfbb71cec3f98aa786c21cbe2"; + }; + vimdoc = fetchurl { + url = "https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz"; + hash = "sha256:1ff8f4afd3a9599dd4c3ce87c155660b078c1229704d1a254433e33794b8f274"; + }; + query = fetchurl { + url = "https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz"; + hash = "sha256:e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c"; + }; +} diff --git a/pkgs/by-name/ne/neovim-unwrapped/update-treesitter-parsers.py b/pkgs/by-name/ne/neovim-unwrapped/update-treesitter-parsers.py new file mode 100755 index 0000000000000..27260ca649172 --- /dev/null +++ b/pkgs/by-name/ne/neovim-unwrapped/update-treesitter-parsers.py @@ -0,0 +1,46 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python3 -p python3 + +import re +import subprocess +from pathlib import Path + +parsers = {} +dir = Path(__file__).parent +regex = re.compile(r"^set\(TREESITTER_([A-Z_]+)_(URL|SHA256)\s+([^ \)]+)\s*\)\s*$") + +src = subprocess.check_output( + [ + "nix-build", + dir.parent.parent.parent.parent, + "-A", + "neovim-unwrapped.src", + "--no-out-link", + ], + text=True, +).strip() + +for line in open(f"{src}/cmake.deps/CMakeLists.txt"): + m = regex.fullmatch(line) + if m is None: + continue + + lang = m[1].lower() + ty = m[2] + val = m[3] + + if not lang in parsers: + parsers[lang] = {} + parsers[lang][ty] = val + +with open(dir / "treesitter-parsers.nix", "w") as f: + f.write("{ fetchurl }:\n\n{\n") + for lang, src in parsers.items(): + f.write( + f""" {lang} = fetchurl {{ + url = "{src["URL"]}"; + hash = "sha256:{src["SHA256"]}"; + }}; +""" + ) + f.write("}\n") diff --git a/pkgs/by-name/ne/netscanner/package.nix b/pkgs/by-name/ne/netscanner/package.nix index 16c1f2d847ff4..01dd71d3ca21f 100644 --- a/pkgs/by-name/ne/netscanner/package.nix +++ b/pkgs/by-name/ne/netscanner/package.nix @@ -6,7 +6,7 @@ }: let pname = "netscanner"; - version = "0.4.4"; + version = "0.4.5"; in rustPlatform.buildRustPackage { inherit pname version; @@ -17,10 +17,10 @@ rustPlatform.buildRustPackage { owner = "Chleba"; repo = "netscanner"; rev = "refs/tags/v${version}"; - hash = "sha256-RO0+Zz1sivIjD8OM4TBHR5geJw540MAJfXEl2yriH6o="; + hash = "sha256-mR+jazZ2Xnf5xuWbVrFCfGOR+sjEUWL3WqHJynIHVFQ="; }; - cargoHash = "sha256-GJLrUF2YAMtCtXTPJvlUURfiTYBFUE6Gmeux+5RXqAM="; + cargoHash = "sha256-+FTbvS4wqBjEL+uWYKhHQp0uMmrvVPYwxdQeZ4cWrhw="; postFixup = '' wrapProgram $out/bin/netscanner \ |