From 43d8a46d853a30ec99b7cfa50d98a14b006d842d Mon Sep 17 00:00:00 2001 From: xgroleau Date: Fri, 7 Oct 2022 11:53:42 -0400 Subject: [PATCH] slint-lsp: init 0.3.0 support for macos fix use gpl3plus instead Moved fontconfig patchelf on linux only --- .../tools/misc/slint-lsp/default.nix | 66 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 5 ++ 2 files changed, 71 insertions(+) create mode 100644 pkgs/development/tools/misc/slint-lsp/default.nix diff --git a/pkgs/development/tools/misc/slint-lsp/default.nix b/pkgs/development/tools/misc/slint-lsp/default.nix new file mode 100644 index 0000000000000..2211b5211d6a6 --- /dev/null +++ b/pkgs/development/tools/misc/slint-lsp/default.nix @@ -0,0 +1,66 @@ +{ lib +, stdenv +, rustPlatform +, fetchCrate +, pkg-config +, cmake +, fontconfig +, libGL +, libxcb +, libX11 +, libXcursor +, libXi +, libXrandr +, libxkbcommon +, wayland + # Darwin Frameworks +, AppKit +, CoreGraphics +, CoreServices +, CoreText +, Foundation +, libiconv +, OpenGL +}: + +let + rpathLibs = [ fontconfig libGL libxcb libX11 libXcursor libXrandr libXi ] + ++ lib.optionals stdenv.isLinux [ libxkbcommon wayland ]; +in +rustPlatform.buildRustPackage rec { + pname = "slint-lsp"; + version = "0.3.0"; + + src = fetchCrate { + inherit pname version; + sha256 = "sha256-dZYkiYrotW8td5dxnPSvDzkWf+xV4ceISVLRZx2goXo="; + }; + + cargoSha256 = "sha256-9zbA9JXfLdosCU6gVsrsAyiyX8Qh6x5wMw1W4QKqbp4="; + + nativeBuildInputs = [ cmake pkg-config fontconfig ]; + buildInputs = rpathLibs ++ [ libxcb.dev ] + ++ lib.optionals stdenv.isDarwin [ + AppKit + CoreGraphics + CoreServices + CoreText + Foundation + libiconv + OpenGL + ]; + + postInstall = lib.optionalString stdenv.isLinux '' + patchelf --set-rpath ${lib.makeLibraryPath rpathLibs} $out/bin/slint-lsp + ''; + + dontPatchELF = true; + + meta = with lib; { + description = "Language Server Protocol (LSP) for Slint UI language"; + homepage = "https://slint-ui.com/"; + changelog = "https://github.com/slint-ui/slint/blob/v${version}/CHANGELOG.md"; + license = with licenses; [ gpl3Plus ]; + maintainers = with maintainers; [ xgroleau ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1b7297191de4e..7ba381220f4a6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17300,6 +17300,11 @@ with pkgs; slimerjs = callPackage ../development/tools/slimerjs {}; + slint-lsp = callPackage ../development/tools/misc/slint-lsp { + inherit (xorg) libXcursor libXi; + inherit (darwin.apple_sdk.frameworks) AppKit CoreGraphics CoreServices CoreText Foundation OpenGL; + }; + sloccount = callPackage ../development/tools/misc/sloccount { }; sloc = nodePackages.sloc;