Skip to content

Instantly share code, notes, and snippets.

@theotherjimmy
Created May 26, 2020 20:34
Show Gist options
  • Save theotherjimmy/d830cc971c9a9c4f0385eb7bd687d814 to your computer and use it in GitHub Desktop.
Save theotherjimmy/d830cc971c9a9c4f0385eb7bd687d814 to your computer and use it in GitHub Desktop.
WIP neovide packaging for Nixos
{ rustPlatform
, fetchurl
, defaultCrateOverrides
, callPackage
, lib
, cmake
, pkgconfig
, cargo
, rustc
, python
, llvmPackages_latest
, expat
, openssl
, freetype
, harfbuzz
, icu
, libjpeg_turbo
, libpng
, zlib
, SDL2
, vulkan-loader
}:
let
skia = callPackage ./skia.nix {};
in rustPlatform.buildRustPackage rec {
pname = "neovide";
version = "0.6.0";
src = builtins.filterSource
(path: type:
type == "directory"
|| lib.strings.hasSuffix ".rs" path
|| lib.strings.hasSuffix ".h" path
|| lib.strings.hasSuffix ".cpp" path
|| lib.strings.hasSuffix ".toml" path
|| lib.strings.hasSuffix ".lock" path
|| lib.strings.hasSuffix ".otf" path
|| lib.strings.hasSuffix ".desktop" path
|| lib.strings.hasSuffix ".ico" path
)
./.;
cargoSha256 = "0qkililxcwjhsvk354ly0bz1gxfqa65ka66f3zri85n3gr9fr397";
nativeBuildInputs = [
cmake
pkgconfig
cargo
rustc
python
] ++ (with llvmPackages_latest; [
clang
llvm
]);
buildInputs = [
skia
expat
openssl
freetype
SDL2
vulkan-loader
];
}
{ stdenv, lib, fetchFromGitHub, fetchgit, python2, gn, ninja
, fontconfig, expat, icu58, libglvnd, libjpeg, libpng, libwebp, zlib
, mesa, libX11, harfbuzz
}:
stdenv.mkDerivation {
name = "skia-rust-skia-m71";
src = fetchFromGitHub {
owner = "rust-skia";
repo = "skia";
rev = "fbf4fc089d823a9fefdaa529ac55625933f23760";
sha256 = "1i4in5azgqm9ck2mqzbp64hin68a1bv5hwxlbf63s8mz302p9w8d";
};
nativeBuildInputs = [ python2 gn ninja];
buildInputs = [
fontconfig expat icu58 libglvnd libjpeg libpng libwebp zlib
mesa libX11 harfbuzz
];
configurePhase = ''
runHook preConfigure
mkdir third_party/external
gn gen out/Release --args="is_debug=false is_official_build=true skia_enable_gpu=true skia_use_gl=false skia_use_system_libjpeg_turbo=true skia_use_system_libpng=true skia_use_system_zlib=true skia_use_xps=false skia_use_dng_sdk=false skia_use_libheif=false skia_enable_vulkan_debug_layers=false skia_enable_atlas_text=false skia_enable_spirv_validation=false skia_enable_tools=false skia_enable_skshaper=true skia_use_icu=true skia_use_system_icu=true skia_use_harfbuzz=true skia_pdf_subset_harfbuzz=true skia_use_system_harfbuzz=true skia_use_sfntly=false skia_enable_skparagraph=true skia_use_expat=true skia_use_system_expat=true skia_use_vulkan=true paragraph_tests_enabled=false extra_cflags=[\"-I${harfbuzz.dev}/include/harfbuzz\"]"
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
ninja -C out/Release skia
runHook postBuild
'';
installPhase = ''
mkdir -p $out
# Glob will match all subdirs.
shopt -s globstar
# All these paths are used in some way when building aseprite.
cp -r --parents -t $out/ \
include/codec \
include/config \
include/core \
include/effects \
include/gpu \
include/private \
include/utils \
out/Release/*.a \
src/gpu/**/*.h \
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment