1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 nix-update-script,
7}:
8
9rustPlatform.buildRustPackage (finalAttrs: {
10 pname = "lightningcss";
11 version = "1.30.1";
12
13 src = fetchFromGitHub {
14 owner = "parcel-bundler";
15 repo = "lightningcss";
16 tag = "v${finalAttrs.version}";
17 hash = "sha256-imLbsQ2F5CQiepwWSMcXj0Fgyv4liCMmCwA/0SE07Mo=";
18 };
19
20 cargoHash = "sha256-aNho9NavEgY4dwGcNXsLDnlVCB2rODIPae3LnfOwJIA=";
21
22 patches = [
23 # Backport fix for build error for lightningcss-napi
24 # see https://github.com/parcel-bundler/lightningcss/pull/713
25 # FIXME: remove when merged upstream
26 ./0001-napi-fix-build-error-in-cargo-auditable.patch
27 ];
28
29 buildFeatures = [
30 "cli"
31 ];
32
33 cargoBuildFlags = [
34 "--lib"
35 "--bin=lightningcss"
36 ];
37
38 cargoTestFlags = [
39 "--lib"
40 ];
41
42 passthru.updateScript = nix-update-script { };
43
44 meta = {
45 description = "Extremely fast CSS parser, transformer, and minifier written in Rust";
46 homepage = "https://lightningcss.dev/";
47 changelog = "https://github.com/parcel-bundler/lightningcss/releases/tag/v${finalAttrs.version}";
48 license = lib.licenses.mpl20;
49 maintainers = with lib.maintainers; [
50 johnrtitor
51 toastal
52 ];
53 mainProgram = "lightningcss";
54 platforms = lib.platforms.all;
55 };
56})