nixpkgs/pkgs/applications/editors/neovim/neovide/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

120 lines
2.9 KiB
Nix
Raw Normal View History

2022-12-05 18:59:15 +00:00
{ lib
, rustPlatform
, clangStdenv
2021-05-14 14:42:03 +00:00
, fetchFromGitHub
2022-12-05 18:59:15 +00:00
, linkFarm
2021-05-14 14:42:03 +00:00
, fetchgit
2022-12-05 18:59:15 +00:00
, runCommand
, gn
, neovim
2022-12-05 18:59:15 +00:00
, ninja
2021-05-14 14:42:03 +00:00
, makeWrapper
, pkg-config
2021-12-09 06:14:04 +00:00
, python3
2022-12-05 18:59:15 +00:00
, removeReferencesTo
, xcbuild
2021-05-14 14:42:03 +00:00
, SDL2
, fontconfig
2022-12-05 18:59:15 +00:00
, xorg
, stdenv
, darwin
, libglvnd
, libxkbcommon
2021-10-21 17:17:46 +00:00
, enableWayland ? stdenv.isLinux
, wayland
2021-05-14 14:42:03 +00:00
}:
2022-12-05 18:59:15 +00:00
rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec {
2021-05-14 14:42:03 +00:00
pname = "neovide";
2024-01-29 04:16:32 +00:00
version = "0.12.2";
2021-05-14 14:42:03 +00:00
src = fetchFromGitHub {
2022-12-05 18:59:15 +00:00
owner = "neovide";
repo = "neovide";
rev = version;
2024-01-29 04:16:32 +00:00
sha256 = "sha256-M19LKNjUmC0WkVGm4t7vjxgMMe0FdMTmB1mLcG33OUg=";
};
2021-05-14 14:42:03 +00:00
2024-01-29 04:16:32 +00:00
cargoHash = "sha256-2fPprZVT7V+Ot8aCpWj6WTdyFylmzlujFdTJCrtE0rk=";
2021-05-14 14:42:03 +00:00
SKIA_SOURCE_DIR =
2021-05-14 14:42:03 +00:00
let
repo = fetchFromGitHub {
owner = "rust-skia";
repo = "skia";
# see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
2023-12-24 11:12:59 +00:00
rev = "m119-0.67.3";
sha256 = "sha256-U75NuJnQa5+SNlOrsBmdlvflGdjo3el63EeIsbnE7ms=";
2021-05-14 14:42:03 +00:00
};
# The externals for skia are taken from skia/DEPS
2022-12-05 18:59:15 +00:00
externals = linkFarm "skia-externals" (lib.mapAttrsToList
(name: value: { inherit name; path = fetchgit value; })
(lib.importJSON ./skia-externals.json));
2021-05-14 14:42:03 +00:00
in
2022-12-05 18:59:15 +00:00
runCommand "source" { } ''
cp -R ${repo} $out
chmod -R +w $out
ln -s ${externals} $out/third_party/externals
''
;
2021-05-14 14:42:03 +00:00
SKIA_GN_COMMAND = "${gn}/bin/gn";
2022-12-05 18:59:15 +00:00
SKIA_NINJA_COMMAND = "${ninja}/bin/ninja";
2021-05-14 14:42:03 +00:00
nativeBuildInputs = [
makeWrapper
2022-12-05 18:59:15 +00:00
pkg-config
python3 # skia
removeReferencesTo
2022-09-16 21:12:00 +00:00
] ++ lib.optionals stdenv.isDarwin [ xcbuild ];
2021-05-14 14:42:03 +00:00
nativeCheckInputs = [ neovim ];
2021-05-14 14:42:03 +00:00
buildInputs = [
SDL2
2022-12-05 18:59:15 +00:00
fontconfig
rustPlatform.bindgenHook
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.AppKit
];
2021-05-14 14:42:03 +00:00
2021-10-21 17:17:46 +00:00
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 \
2021-10-21 17:17:46 +00:00
--prefix LD_LIBRARY_PATH : ${libPath}
'';
2021-05-14 14:42:03 +00:00
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 ];
2021-05-14 14:42:03 +00:00
meta = with lib; {
description = "This is a simple graphical user interface for Neovim.";
mainProgram = "neovide";
2022-12-05 18:59:15 +00:00
homepage = "https://github.com/neovide/neovide";
changelog = "https://github.com/neovide/neovide/releases/tag/${version}";
2021-05-14 14:42:03 +00:00
license = with licenses; [ mit ];
maintainers = with maintainers; [ ck3d ];
2023-12-24 11:12:59 +00:00
platforms = platforms.all;
2021-05-14 14:42:03 +00:00
};
}