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.

135 lines
3.4 KiB
Nix
Raw Normal View History

2021-05-14 14:42:03 +00:00
{ rustPlatform
, runCommand
, lib
, fetchFromGitHub
, fetchgit
, fetchurl
2021-05-14 14:42:03 +00:00
, makeWrapper
, pkg-config
, python2
2021-12-09 06:14:04 +00:00
, python3
2021-05-14 14:42:03 +00:00
, openssl
, SDL2
, fontconfig
, freetype
2021-05-14 14:42:03 +00:00
, ninja
, gn
, llvmPackages
, makeFontsConf
, libglvnd
, libxkbcommon
2021-10-21 17:17:46 +00:00
, stdenv
, enableWayland ? stdenv.isLinux
, wayland
, xorg
2021-05-14 14:42:03 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "neovide";
2022-06-30 12:02:39 +00:00
version = "0.9.0";
2021-05-14 14:42:03 +00:00
src = fetchFromGitHub {
owner = "Kethku";
repo = "neovide";
rev = version;
2022-06-30 12:02:39 +00:00
sha256 = "sha256-2fN05o8Zo1MGdIYUcsCgkiW/kG6DkY8uTnpw2XrKxrI=";
};
2021-05-14 14:42:03 +00:00
2022-06-30 12:02:39 +00:00
cargoSha256 = "sha256-eATUyczkcwHI8Y7Gl2ts4dRgiFUAL8yrWDNe4JzserE=";
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
2022-06-30 12:02:39 +00:00
rev = "m100-0.48.7";
sha256 = "sha256-roZUv5YoLolRi0iWAB+5WlCFV+8GdzNzS+JINnEHaMs=";
2021-05-14 14:42:03 +00:00
};
# The externals for skia are taken from skia/DEPS
externals = lib.mapAttrs (n: fetchgit) (lib.importJSON ./skia-externals.json);
2021-05-14 14:42:03 +00:00
in
runCommand "source" {} (
''
cp -R ${repo} $out
chmod -R +w $out
2021-05-14 14:42:03 +00:00
mkdir -p $out/third_party/externals
cd $out/third_party/externals
'' + (builtins.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "cp -ra ${value} ${name}") externals))
);
2021-05-14 14:42:03 +00:00
SKIA_NINJA_COMMAND = "${ninja}/bin/ninja";
SKIA_GN_COMMAND = "${gn}/bin/gn";
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
2021-05-14 14:42:03 +00:00
preConfigure = ''
unset CC CXX
'';
2021-05-14 14:42:03 +00:00
# test needs a valid fontconfig file
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
nativeBuildInputs = [
pkg-config
makeWrapper
python2 # skia-bindings
2021-12-09 06:14:04 +00:00
python3 # rust-xcb
2021-05-14 14:42:03 +00:00
llvmPackages.clang # skia
];
# All tests passes but at the end cargo prints for unknown reason:
# error: test failed, to rerun pass '--bin neovide'
# Increasing the loglevel did not help. In a nix-shell environment
# the failure do not occure.
doCheck = false;
buildInputs = [
openssl
SDL2
(fontconfig.overrideAttrs (old: {
propagatedBuildInputs = [
# skia is not compatible with freetype 2.11.0
(freetype.overrideAttrs (old: rec {
version = "2.10.4";
src = fetchurl {
url = "mirror://savannah/${old.pname}/${old.pname}-${version}.tar.xz";
sha256 = "112pyy215chg7f7fmp2l9374chhhpihbh8wgpj5nj6avj3c59a46";
};
}))
];
}))
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 ''
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
'';
2021-05-14 14:42:03 +00:00
meta = with lib; {
description = "This is a simple graphical user interface for Neovim.";
homepage = "https://github.com/Kethku/neovide";
license = with licenses; [ mit ];
maintainers = with maintainers; [ ck3d ];
platforms = platforms.linux;
mainProgram = "neovide";
2021-05-14 14:42:03 +00:00
};
}