-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathflake.nix
More file actions
59 lines (57 loc) · 2.06 KB
/
Copy pathflake.nix
File metadata and controls
59 lines (57 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
description = "Fast Mermaid diagram renderer in pure Rust - 23 diagram types, 100-1400x faster than mermaid-cli";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
# nixpkgs-unstable dropped x86_64-darwin in 26.11. Keep the flake's
# advertised systems aligned with platforms that current nixpkgs supports.
flake-utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
mmdr = pkgs.rustPlatform.buildRustPackage {
pname = "mermaid-rs-renderer";
version = cargoToml.package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.pkg-config ];
# mmdr is pure Rust; font discovery happens at runtime via fontdb.
# fontconfig/freetype are listed for Linux so system fonts resolve
# in PNG rendering environments that expect them.
buildInputs =
pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.fontconfig
pkgs.freetype
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv
];
doCheck = false;
meta = {
description = "Fast Mermaid diagram renderer in pure Rust - 23 diagram types, 100-1400x faster than mermaid-cli";
homepage = "https://github.com/1jehuang/mermaid-rs-renderer";
license = pkgs.lib.licenses.mit;
mainProgram = "mmdr";
};
};
in
{
packages.default = mmdr;
apps.default = {
type = "app";
program = "${mmdr}/bin/mmdr";
meta = mmdr.meta;
};
devShells.default = pkgs.mkShell {
inputsFrom = [ mmdr ];
packages = [ pkgs.rustc pkgs.cargo pkgs.clippy pkgs.rustfmt ];
};
}
);
}