Files
nixpkgs/pkgs/by-name/ne/neovide/package.nix
Christian Kögler 645bd47dee neovide: make LD_LIBRARY_PATH wrapping Linux-only
The wrapProgram for LD_LIBRARY_PATH is only needed on Linux;
don't install it on Darwin (or other platforms).
2026-05-31 19:47:57 +02:00

145 lines
3.4 KiB
Nix

{
lib,
rustPlatform,
clangStdenv,
fetchFromGitHub,
linkFarm,
fetchgit,
runCommand,
gn,
neovim,
ninja,
makeWrapper,
pkg-config,
python3,
removeReferencesTo,
cctools,
SDL2,
fontconfig,
libxrandr,
libxi,
libxext,
libxcursor,
libx11,
stdenv,
libglvnd,
libxkbcommon,
enableWayland ? stdenv.hostPlatform.isLinux,
wayland,
}:
rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } (finalAttrs: {
pname = "neovide";
version = "0.16.2";
src = fetchFromGitHub {
owner = "neovide";
repo = "neovide";
tag = finalAttrs.version;
hash = "sha256-mzlyw9NIBb35QJ5L7+ZxgJ5IUoHznAUQOLA0SglJ3bw=";
};
cargoHash = "sha256-WVNmG+KJK93yLrL2/KPc2czAxwt5brKxRkrPB7Bv46M=";
env = {
SKIA_SOURCE_DIR =
let
repo = fetchFromGitHub {
owner = "rust-skia";
repo = "skia";
# see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
tag = "m145-0.92.0";
hash = "sha256-9N780AwheKBJRcZC4l/uWFNq+oOyoNp4M6dJAVVAFeo=";
};
# 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.hostPlatform.isDarwin [
cctools.libtool
];
nativeCheckInputs = [ neovim ];
buildInputs = [
SDL2
fontconfig
rustPlatform.bindgenHook
];
postFixup =
let
libPath = lib.makeLibraryPath (
[
libglvnd
libxkbcommon
libx11
libxcursor
libxext
libxrandr
libxi
]
++ lib.optionals enableWayland [ wayland ]
);
in
''
# library skia embeds the path to its sources
remove-references-to -t "$SKIA_SOURCE_DIR" \
$out/bin/neovide
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
wrapProgram $out/bin/neovide \
--prefix LD_LIBRARY_PATH : ${libPath}
'';
postInstall =
lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
cp -r extra/osx/Neovide.app $out/Applications
ln -s $out/bin $out/Applications/Neovide.app/Contents/MacOS
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
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 = [ finalAttrs.env.SKIA_SOURCE_DIR ];
meta = {
description = "Simple, no-nonsense, cross-platform graphical user interface for Neovim";
mainProgram = "neovide";
homepage = "https://neovide.dev/";
changelog = "https://github.com/neovide/neovide/releases/tag/${finalAttrs.version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
ck3d
caverav
];
platforms = lib.platforms.unix;
};
})