refactor(nix): package Neovide from upstream/HEAD

This commit is contained in:
Price Hiller 2024-05-12 01:53:58 -05:00
parent 094f7f2e73
commit 24eaa2984a
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
3 changed files with 193 additions and 0 deletions

View File

@ -4,6 +4,7 @@
rustPlatform = pkgs.rustPlatform;
fetchFromGitHub = pkgs.fetchFromGitHub;
};
neovide = pkgs.callPackage ./neovide/package.nix { };
Fmt = pkgs.writeShellApplication {
name = "Fmt";
runtimeInputs = with pkgs; [

125
pkgs/neovide/package.nix Normal file
View File

@ -0,0 +1,125 @@
{
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 = "35ea46a3fef7f9938830dd8e294b696dfe24af56";
sha256 = "sha256-wsMNYwkYtW8MbK+ZD1dX2dxy7Elu8BA9ptta9rQZJuo=";
};
cargoHash = "sha256-y3zcx6wucjkbzHGm/ameElFoDazhQ8OSUcxKTx+86TY=";
SKIA_SOURCE_DIR =
let
repo = fetchFromGitHub {
owner = "rust-skia";
repo = "skia";
# see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
rev = "d0410d4e6f703f06f6adc2b3793b284aeb23b0e9";
sha256 = "sha256-zlHUJUXukE4CsXwwmVl3KHf9mnNPT8lC/ETEE15Gb4s=";
};
# 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;
};
}

View File

@ -0,0 +1,67 @@
{
"brotli": {
"url": "https://skia.googlesource.com/external/github.com/google/brotli.git",
"rev": "6d03dfbedda1615c4cba1211f8d81735575209c8",
"sha256": "sha256-wnHEQY/NYS48sMPElUWSeLsETyQbWw2sMScc4geaPFA="
},
"d3d12allocator": {
"url": "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git",
"rev": "169895d529dfce00390a20e69c2f516066fe7a3b",
"sha256": "sha256-5DbR/3Lb0eMBpHNf7MtZOb1C0QrNlx/ZvPVbCxxF9eQ="
},
"expat": {
"url": "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git",
"rev": "441f98d02deafd9b090aea568282b28f66a50e36",
"sha256": "sha256-FXTDGAK03jc2wvazhRKqtsFRKZUYS/9HLpZNp4JfZJI="
},
"freetype": {
"url": "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git",
"rev": "f42ce25563b73fed0123d18a2556b9ba01d2c76b",
"sha256": "sha256-r4ct8y0QMCMEV/C6C9ccuJRuvy4OqpqPKbj/a2KHbPA="
},
"harfbuzz": {
"url": "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git",
"rev": "c053e8f29257814e11ad61493dbbe29f27656de4",
"sha256": "sha256-D8DNcZH/oiJqWvfWFHvQ8AwQ3OrMwyZdfGmZ5y30Hvg="
},
"icu": {
"url": "https://chromium.googlesource.com/chromium/deps/icu.git",
"rev": "a0718d4f121727e30b8d52c7a189ebf5ab52421f",
"sha256": "sha256-BI3f/gf9GNDvSfXWeRHKBvznSz4mjXY8rM24kK7QvOM="
},
"libjpeg-turbo": {
"url": "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git",
"rev": "ed683925e4897a84b3bffc5c1414c85b97a129a3",
"sha256": "sha256-DYJP3phe4OzCtRN2pMc07ITTWR8MuIlOWWg9PBsQAVw="
},
"libpng": {
"url": "https://skia.googlesource.com/third_party/libpng.git",
"rev": "144b348e072a78e8130ed0acc452c9f039a67bf2",
"sha256": "sha256-eTF7q7hR4S1OqV2oPQKmcHujA5Od4rGMc5879kT0SkE="
},
"libwebp": {
"url": "https://chromium.googlesource.com/webm/libwebp.git",
"rev": "ca332209cb5567c9b249c86788cb2dbf8847e760",
"sha256": "sha256-gfwUlJ44biO1lB/3SKfMkM/YBiYcz6RqeMOw+0o6Z/Q="
},
"vulkanmemoryallocator": {
"url": "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator",
"rev": "a6bfc237255a6bac1513f7c1ebde6d8aed6b5191",
"sha256": "sha256-urUebQaPTgCECmm4Espri1HqYGy0ueAqTBu/VSiX/8I="
},
"spirv-cross": {
"url": "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross",
"rev": "b8fcf307f1f347089e3c46eb4451d27f32ebc8d3",
"sha256": "sha256-H43M9DXfEuyKuvo6rjb5k0KEbYOSFodbPJh8ZKY4PQg="
},
"wuffs": {
"url": "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git",
"rev": "e3f919ccfe3ef542cfc983a82146070258fb57f8",
"sha256": "sha256-373d2F/STcgCHEq+PO+SCHrKVOo6uO1rqqwRN5eeBCw="
},
"zlib": {
"url": "https://chromium.googlesource.com/chromium/src/third_party/zlib",
"rev": "646b7f569718921d7d4b5b8e22572ff6c76f2596",
"sha256": "sha256-jNj6SuTZ5/a7crtYhxW3Q/TlfRMNMfYIVxDlr7bYdzQ="
}
}