2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, clangStdenv
|
2021-05-20 23:08:51 +00:00
|
|
|
, fetchFromGitHub
|
2022-12-17 10:02:37 +00:00
|
|
|
, linkFarm
|
2021-05-20 23:08:51 +00:00
|
|
|
, fetchgit
|
2022-12-17 10:02:37 +00:00
|
|
|
, runCommand
|
|
|
|
, gn
|
2024-01-13 08:15:51 +00:00
|
|
|
, neovim
|
2022-12-17 10:02:37 +00:00
|
|
|
, ninja
|
2021-05-20 23:08:51 +00:00
|
|
|
, makeWrapper
|
|
|
|
, pkg-config
|
2022-02-10 20:34:41 +00:00
|
|
|
, python3
|
2022-12-17 10:02:37 +00:00
|
|
|
, removeReferencesTo
|
|
|
|
, xcbuild
|
2021-05-20 23:08:51 +00:00
|
|
|
, SDL2
|
|
|
|
, fontconfig
|
2022-12-17 10:02:37 +00:00
|
|
|
, xorg
|
|
|
|
, stdenv
|
|
|
|
, darwin
|
2021-06-28 23:13:55 +00:00
|
|
|
, libglvnd
|
|
|
|
, libxkbcommon
|
2021-10-28 06:52:43 +00:00
|
|
|
, enableWayland ? stdenv.isLinux
|
2021-06-28 23:13:55 +00:00
|
|
|
, wayland
|
2021-05-20 23:08:51 +00:00
|
|
|
}:
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec {
|
2021-05-20 23:08:51 +00:00
|
|
|
pname = "neovide";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "0.12.2";
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
src = fetchFromGitHub {
|
2022-12-17 10:02:37 +00:00
|
|
|
owner = "neovide";
|
2021-06-28 23:13:55 +00:00
|
|
|
repo = "neovide";
|
2022-04-27 09:35:20 +00:00
|
|
|
rev = version;
|
2024-02-07 01:22:34 +00:00
|
|
|
sha256 = "sha256-M19LKNjUmC0WkVGm4t7vjxgMMe0FdMTmB1mLcG33OUg=";
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
cargoHash = "sha256-2fPprZVT7V+Ot8aCpWj6WTdyFylmzlujFdTJCrtE0rk=";
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
SKIA_SOURCE_DIR =
|
2021-05-20 23:08:51 +00:00
|
|
|
let
|
|
|
|
repo = fetchFromGitHub {
|
|
|
|
owner = "rust-skia";
|
|
|
|
repo = "skia";
|
2021-06-28 23:13:55 +00:00
|
|
|
# see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
|
2024-01-02 11:29:13 +00:00
|
|
|
rev = "m119-0.67.3";
|
|
|
|
sha256 = "sha256-U75NuJnQa5+SNlOrsBmdlvflGdjo3el63EeIsbnE7ms=";
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
|
|
|
# The externals for skia are taken from skia/DEPS
|
2022-12-17 10:02:37 +00:00
|
|
|
externals = linkFarm "skia-externals" (lib.mapAttrsToList
|
|
|
|
(name: value: { inherit name; path = fetchgit value; })
|
|
|
|
(lib.importJSON ./skia-externals.json));
|
2021-05-20 23:08:51 +00:00
|
|
|
in
|
2022-12-17 10:02:37 +00:00
|
|
|
runCommand "source" { } ''
|
|
|
|
cp -R ${repo} $out
|
|
|
|
chmod -R +w $out
|
|
|
|
ln -s ${externals} $out/third_party/externals
|
|
|
|
''
|
|
|
|
;
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
SKIA_GN_COMMAND = "${gn}/bin/gn";
|
2022-12-17 10:02:37 +00:00
|
|
|
SKIA_NINJA_COMMAND = "${ninja}/bin/ninja";
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
2022-12-17 10:02:37 +00:00
|
|
|
pkg-config
|
|
|
|
python3 # skia
|
2022-10-21 18:38:19 +00:00
|
|
|
removeReferencesTo
|
2022-09-22 12:36:57 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [ xcbuild ];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeCheckInputs = [ neovim ];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
2022-12-17 10:02:37 +00:00
|
|
|
fontconfig
|
|
|
|
rustPlatform.bindgenHook
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.apple_sdk.frameworks.AppKit
|
|
|
|
];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
postFixup = let
|
|
|
|
libPath = lib.makeLibraryPath ([
|
|
|
|
libglvnd
|
|
|
|
libxkbcommon
|
|
|
|
xorg.libXcursor
|
|
|
|
xorg.libXext
|
|
|
|
xorg.libXrandr
|
|
|
|
xorg.libXi
|
|
|
|
] ++ lib.optionals enableWayland [ wayland ]);
|
|
|
|
in ''
|
2022-10-21 18:38:19 +00:00
|
|
|
# library skia embeds the path to its sources
|
|
|
|
remove-references-to -t "$SKIA_SOURCE_DIR" \
|
|
|
|
$out/bin/neovide
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
wrapProgram $out/bin/neovide \
|
2021-10-28 06:52:43 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : ${libPath}
|
2021-06-28 23:13:55 +00:00
|
|
|
'';
|
2021-05-20 23:08:51 +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
|
|
|
|
'';
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
disallowedReferences = [ SKIA_SOURCE_DIR ];
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "This is a simple graphical user interface for Neovim.";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "neovide";
|
2022-12-17 10:02:37 +00:00
|
|
|
homepage = "https://github.com/neovide/neovide";
|
|
|
|
changelog = "https://github.com/neovide/neovide/releases/tag/${version}";
|
2021-05-20 23:08:51 +00:00
|
|
|
license = with licenses; [ mit ];
|
2024-04-21 15:54:59 +00:00
|
|
|
maintainers = with maintainers; [ ck3d ];
|
2024-01-02 11:29:13 +00:00
|
|
|
platforms = platforms.all;
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
|
|
|
}
|