nixpkgs/pkgs/applications/editors/lapce/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

132 lines
3.5 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, nix-update-script
, rustPlatform
, cmake
, pkg-config
, perl
2023-12-05 06:37:07 +00:00
, python3
, fontconfig
2022-06-29 11:59:37 +00:00
, glib
, gtk3
2022-04-23 04:20:00 +00:00
, openssl
2023-12-05 06:37:07 +00:00
, libGL
2022-04-23 04:20:00 +00:00
, libobjc
2023-12-05 06:37:07 +00:00
, libxkbcommon
2022-04-23 04:20:00 +00:00
, Security
, CoreServices
, ApplicationServices
, Carbon
, AppKit
, wrapGAppsHook3
2023-12-05 06:37:07 +00:00
, wayland
, gobject-introspection
2023-12-05 06:37:07 +00:00
, xorg
}:
2023-12-05 06:37:07 +00:00
let
rpathLibs = lib.optionals stdenv.isLinux [
libGL
libxkbcommon
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
xorg.libXxf86vm
xorg.libxcb
wayland
];
in
rustPlatform.buildRustPackage rec {
pname = "lapce";
version = "0.4.0";
src = fetchFromGitHub {
owner = "lapce";
repo = "lapce";
rev = "refs/tags/v${version}";
sha256 = "sha256-x/EObvrMZ3bkdHk5SbfQEarXA7jcQ9rEFZINQrHjcl4=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"floem-0.1.1" = "sha256-/RUsi0LUJ/LjDj8xjoiF+f4MeUjFASL0TDS0eDUEHio=";
2023-03-25 00:40:30 +00:00
"human-sort-0.2.2" = "sha256-tebgIJGXOY7pwWRukboKAzXY47l4Cn//0xMKQTaGu8w=";
"lsp-types-0.95.1" = "sha256-+tWqDBM5x/gvQOG7V3m2tFBZB7smgnnZHikf9ja2FfE=";
2023-12-05 06:37:07 +00:00
"psp-types-0.1.0" = "sha256-/oFt/AXxCqBp21hTSYrokWsbFYTIDCrHMUBuA2Nj5UU=";
"regalloc2-0.9.3" = "sha256-tzXFXs47LDoNBL1tSkLCqaiHDP5vZjvh250hz0pbEJs=";
"structdesc-0.1.0" = "sha256-gMTnRudc3Tp9JRa+Cob5Ke23aqajP8lSun5CnT13+eQ=";
"tracing-0.2.0" = "sha256-31jmSvspNstOAh6VaWie+aozmGu4RpY9Gx2kbBVD+CI=";
"tree-sitter-bash-0.19.0" = "sha256-gTsA874qpCI/N5tmBI5eT8KDaM25gXM4VbcCbUU2EeI=";
"tree-sitter-md-0.1.2" = "sha256-gKbjAcY/x9sIxiG7edolAQp2JWrx78mEGeCpayxFOuE=";
"tree-sitter-yaml-0.0.1" = "sha256-bQ/APnFpes4hQLv37lpoADyjXDBY7J4Zg+rLyUtbra4=";
2023-12-05 06:37:07 +00:00
"wasi-experimental-http-wasmtime-0.10.0" = "sha256-FuF3Ms1bT9bBasbLK+yQ2xggObm/lFDRyOvH21AZnQI=";
};
};
2023-12-05 06:37:07 +00:00
env = {
# Get openssl-sys to use pkg-config
OPENSSL_NO_VENDOR = 1;
# This variable is read by build script, so that Lapce editor knows its version
RELEASE_TAG_NAME = "v${version}";
};
2023-06-23 03:13:07 +00:00
postPatch = ''
2023-12-05 06:37:07 +00:00
substituteInPlace lapce-app/Cargo.toml --replace ", \"updater\"" ""
2023-06-23 03:13:07 +00:00
'';
nativeBuildInputs = [
cmake
pkg-config
perl
2023-12-05 06:37:07 +00:00
python3
wrapGAppsHook3 # FIX: No GSettings schemas are installed on the system
gobject-introspection
];
2023-12-05 06:37:07 +00:00
buildInputs = rpathLibs ++ [
2022-06-29 11:59:37 +00:00
glib
gtk3
2022-04-23 04:20:00 +00:00
openssl
] ++ lib.optionals stdenv.isLinux [
fontconfig
2022-04-23 04:20:00 +00:00
] ++ lib.optionals stdenv.isDarwin [
libobjc
Security
CoreServices
ApplicationServices
Carbon
AppKit
];
2023-12-05 06:37:07 +00:00
postInstall = if stdenv.isLinux then ''
2023-07-02 22:40:26 +00:00
install -Dm0644 $src/extra/images/logo.svg $out/share/icons/hicolor/scalable/apps/dev.lapce.lapce.svg
install -Dm0644 $src/extra/linux/dev.lapce.lapce.desktop $out/share/applications/lapce.desktop
2023-12-05 06:37:07 +00:00
$STRIP -S $out/bin/lapce
patchelf --add-rpath "${lib.makeLibraryPath rpathLibs}" $out/bin/lapce
'' else ''
mkdir $out/Applications
cp -r extra/macos/Lapce.app $out/Applications
ln -s $out/bin $out/Applications/Lapce.app/Contents/MacOS
'';
2023-12-05 06:37:07 +00:00
dontPatchELF = true;
passthru.updateScript = nix-update-script { };
2022-11-25 05:33:01 +00:00
meta = with lib; {
description = "Lightning-fast and Powerful Code Editor written in Rust";
homepage = "https://github.com/lapce/lapce";
changelog = "https://github.com/lapce/lapce/releases/tag/v${version}";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ elliot ];
2024-01-19 08:08:55 +00:00
mainProgram = "lapce";
2024-04-26 08:35:58 +00:00
# Undefined symbols for architecture x86_64: "_NSPasteboardTypeFileURL"
broken = stdenv.isDarwin && stdenv.isx86_64;
};
}