Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 nix-update-script, 6 rustPlatform, 7 cmake, 8 pkg-config, 9 perl, 10 python3, 11 fontconfig, 12 glib, 13 gtk3, 14 openssl, 15 libGL, 16 libxkbcommon, 17 wrapGAppsHook3, 18 wayland, 19 gobject-introspection, 20 xorg, 21}: 22let 23 rpathLibs = lib.optionals stdenv.hostPlatform.isLinux [ 24 libGL 25 libxkbcommon 26 xorg.libX11 27 xorg.libXcursor 28 xorg.libXi 29 xorg.libXrandr 30 xorg.libXxf86vm 31 xorg.libxcb 32 wayland 33 ]; 34in 35rustPlatform.buildRustPackage rec { 36 pname = "lapce"; 37 version = "0.4.2"; 38 39 src = fetchFromGitHub { 40 owner = "lapce"; 41 repo = "lapce"; 42 tag = "v${version}"; 43 sha256 = "sha256-vBBYNHgZiW5JfGeUG6YZObf4oK0hHxTbsZNTfnIX95Y="; 44 }; 45 46 cargoHash = "sha256-cgSr1GHQUF4ccVd9w3TT0+EI+lqQpDzfXHdRWr75eDE="; 47 48 env = { 49 # Get openssl-sys to use pkg-config 50 OPENSSL_NO_VENDOR = 1; 51 52 # This variable is read by build script, so that Lapce editor knows its version 53 RELEASE_TAG_NAME = "v${version}"; 54 }; 55 56 postPatch = '' 57 substituteInPlace lapce-app/Cargo.toml --replace ", \"updater\"" "" 58 ''; 59 60 nativeBuildInputs = [ 61 cmake 62 pkg-config 63 perl 64 python3 65 wrapGAppsHook3 # FIX: No GSettings schemas are installed on the system 66 gobject-introspection 67 ]; 68 69 buildInputs = 70 rpathLibs 71 ++ [ 72 glib 73 gtk3 74 openssl 75 ] 76 ++ lib.optionals stdenv.hostPlatform.isLinux [ 77 fontconfig 78 ]; 79 80 postInstall = 81 if stdenv.hostPlatform.isLinux then 82 '' 83 install -Dm0644 $src/extra/images/logo.svg $out/share/icons/hicolor/scalable/apps/dev.lapce.lapce.svg 84 install -Dm0644 $src/extra/linux/dev.lapce.lapce.desktop $out/share/applications/lapce.desktop 85 86 $STRIP -S $out/bin/lapce 87 88 patchelf --add-rpath "${lib.makeLibraryPath rpathLibs}" $out/bin/lapce 89 '' 90 else 91 '' 92 mkdir $out/Applications 93 cp -r extra/macos/Lapce.app $out/Applications 94 ln -s $out/bin $out/Applications/Lapce.app/Contents/MacOS 95 ''; 96 97 dontPatchELF = true; 98 99 passthru.updateScript = nix-update-script { }; 100 101 meta = { 102 description = "Lightning-fast and Powerful Code Editor written in Rust"; 103 homepage = "https://github.com/lapce/lapce"; 104 changelog = "https://github.com/lapce/lapce/releases/tag/v${version}"; 105 license = with lib.licenses; [ asl20 ]; 106 maintainers = with lib.maintainers; [ elliot ]; 107 mainProgram = "lapce"; 108 }; 109}