feat(nix): add own neovide package
Some checks failed
Check Formatting of Files / Check-Formatting (push) Has been cancelled

This commit is contained in:
Price Hiller 2024-07-06 01:23:41 -05:00
parent 7caa3c955e
commit 43bcfa0c9f
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
3 changed files with 169 additions and 0 deletions

View File

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

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

@ -0,0 +1,131 @@
{
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 = "24fcfc94c30775a6ff08277e76d266d2a1bde62c";
src = fetchFromGitHub {
owner = "neovide";
repo = "neovide";
rev = version;
hash = "sha256-5F9U2sE2CUQGSraWJ5plxvYdH498EQbj9U7DK0chWRU=";
};
cargoHash = "sha256-hV0EWjcb1P1GSlgnhJ6Xy0aUBtCK52mHOqdfr/COQbk=";
SKIA_SOURCE_DIR =
let
repo = fetchFromGitHub {
owner = "rust-skia";
repo = "skia";
# see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
rev = "m125-0.72.3";
hash = "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 =
lib.optionalString stdenv.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.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 = [ 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.linux ++ [ "aarch64-darwin" ];
};
}

View File

@ -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": "646b7f569718921d7d4b5b8e22572ff6c76f2596",
"sha256": "sha256-jNj6SuTZ5/a7crtYhxW3Q/TlfRMNMfYIVxDlr7bYdzQ="
},
"harfbuzz": {
"url": "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git",
"rev": "c053e8f29257814e11ad61493dbbe29f27656de4",
"sha256": "sha256-D8DNcZH/oiJqWvfWFHvQ8AwQ3OrMwyZdfGmZ5y30Hvg="
},
"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": "144b348e072a78e8130ed0acc452c9f039a67bf2",
"sha256": "sha256-eTF7q7hR4S1OqV2oPQKmcHujA5Od4rGMc5879kT0SkE="
}
}