about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/neovim/neovide
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/neovim/neovide')
-rw-r--r--nixpkgs/pkgs/applications/editors/neovim/neovide/default.nix122
-rw-r--r--nixpkgs/pkgs/applications/editors/neovim/neovide/skia-externals.json37
2 files changed, 159 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/editors/neovim/neovide/default.nix b/nixpkgs/pkgs/applications/editors/neovim/neovide/default.nix
new file mode 100644
index 000000000000..0142fde1726f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/neovim/neovide/default.nix
@@ -0,0 +1,122 @@
+{ lib
+, rustPlatform
+, clangStdenv
+, fetchFromGitHub
+, linkFarm
+, fetchgit
+, runCommand
+, gn
+, 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.1";
+
+  src = fetchFromGitHub {
+    owner = "neovide";
+    repo = "neovide";
+    rev = version;
+    sha256 = "sha256-lmhTTBlhyEepUNHrm2hq42G1kA7siAsJUcYjBfajaHA=";
+  };
+
+  cargoSha256 = "sha256-1R1JrNhcgC16anr5Gl1b9rHgfRLPJElef5D65joHxj0=";
+
+  SKIA_SOURCE_DIR =
+    let
+      repo = fetchFromGitHub {
+        owner = "rust-skia";
+        repo = "skia";
+        # see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
+        rev = "m119-0.67.3";
+        sha256 = "sha256-U75NuJnQa5+SNlOrsBmdlvflGdjo3el63EeIsbnE7ms=";
+      };
+      # 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 ];
+
+  # 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 = [
+    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.";
+    homepage = "https://github.com/neovide/neovide";
+    changelog = "https://github.com/neovide/neovide/releases/tag/${version}";
+    license = with licenses; [ mit ];
+    maintainers = with maintainers; [ ck3d multisn8 ];
+    platforms = platforms.all;
+    badPlatforms = platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/editors/neovim/neovide/skia-externals.json b/nixpkgs/pkgs/applications/editors/neovim/neovide/skia-externals.json
new file mode 100644
index 000000000000..e57814e2a2d8
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/neovim/neovide/skia-externals.json
@@ -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": "c876c8f87101c5a75f6014b0f832499afeb65b73",
+    "sha256": "sha256-mwozVo8ymyrYN4tw+/ZnSI+xogSTZQ6PUBba/jQqRkE="
+  },
+  "harfbuzz": {
+    "url": "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git",
+    "rev": "4cfc6d8e173e800df086d7be078da2e8c5cfca19",
+    "sha256": "sha256-rrstyAz7Eb8ZgFJZKUASY8nU4YFZAptd5VS9B2cs2Yg="
+  },
+  "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": "386707c6d19b974ca2e3db7f5c61873813c6fe44",
+    "sha256": "sha256-67kf5MBsnBBi0bOfX/RKL52xpaCWm/ampltAI+EeQ+c="
+  }
+}