A better Rust ATProto crate
1{inputs, ...}: {
2 imports = [
3 inputs.rust-flake.flakeModules.default
4 inputs.rust-flake.flakeModules.nixpkgs
5 # inputs.process-compose-flake.flakeModule
6 # inputs.cargo-doc-live.flakeModule
7 ];
8 perSystem = {
9 config,
10 self',
11 pkgs,
12 lib,
13 ...
14 }: let
15 inherit (pkgs.stdenv) isDarwin;
16 inherit (pkgs.darwin) apple_sdk;
17
18 # Common configuration for all crates
19 globalCrateConfig = {
20 crane.clippy.enable = false;
21 };
22
23 # Common build inputs for all crates
24 commonBuildInputs = lib.optionals isDarwin (
25 with apple_sdk.frameworks; [
26 IOKit
27 Security
28 SystemConfiguration
29 ]
30 );
31 in {
32 rust-project = {
33 # Source filtering to avoid unnecessary rebuilds
34 src = lib.cleanSourceWith {
35 src = inputs.self;
36 filter = config.rust-project.crane-lib.filterCargoSources;
37 };
38 crates = {
39 "jacquard" = {
40 imports = [globalCrateConfig];
41 autoWire = ["crate" "clippy"];
42 path = ./../../crates/jacquard;
43 crane = {
44 args = {
45 buildInputs = commonBuildInputs;
46 };
47 };
48 };
49
50 "jacquard-common" = {
51 imports = [globalCrateConfig];
52 autoWire = ["crate" "clippy"];
53 path = ./../../crates/jacquard-common;
54 crane = {
55 args = {
56 buildInputs = commonBuildInputs;
57 };
58 };
59 };
60 };
61 };
62 packages.default = self'.packages.jacquard;
63 };
64}