Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, rustPlatform
3, fetchFromGitHub
4, pkg-config
5, stdenv
6, darwin
7, nix-update-script
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "rome";
12 version = "12.1.3";
13
14 src = fetchFromGitHub {
15 owner = "rome";
16 repo = "tools";
17 rev = "cli/v${version}";
18 hash = "sha256-BlHpdfbyx6nU44vasEw0gRZ0ickyD2eUXPfeFZHSCbI=";
19 };
20
21 cargoHash = "sha256-jHdoRymKPjBonT4TvAiTNzGBuTcNoPsvdFKEf33dpVc=";
22
23 cargoBuildFlags = [ "--package" "rome_cli" ];
24
25 env = {
26 RUSTFLAGS = "-C strip=symbols";
27 ROME_VERSION = "${version}";
28 };
29
30 buildInputs =
31 lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
32
33 nativeBuildInputs = [ pkg-config ];
34
35 # need to manually unset the ROME_VERSION before checkPhase otherwise some tests fail
36 preCheck = ''
37 unset ROME_VERSION;
38 '';
39
40 # these test fail
41 checkFlags = [
42 "--skip parser::tests::uncompleted_markers_panic"
43 "--skip commands::check::fs_error_infinite_symlink_exapansion"
44 "--skip commands::check::fs_error_dereferenced_symlink"
45 ];
46
47 passthru.updateScript = nix-update-script {
48 extraArgs = [ "--version-regex" "cli%2Fv(.*)" ];
49 };
50
51 meta = with lib; {
52 description = "A formatter, linter, bundler, and more for JavaScript, TypeScript, JSON, HTML, Markdown, and CSS";
53 homepage = "https://rome.tools";
54 changelog = "https://github.com/rome/tools/blob/${src.rev}/CHANGELOG.md";
55 license = licenses.mit;
56 maintainers = with maintainers; [ dit7ya felschr ];
57 };
58}