/ lib / nix / default.nix
default.nix
 1  {
 2    inputs,
 3    pkgs,
 4    callPackage,
 5    craneLib,
 6    mkMetric,
 7    distrox-cli,
 8    src,
 9    commonCrateArgs,
10    rustTarget,
11    iroh-relay,
12    runCommand,
13    ...
14  }:
15  
16  let
17    rustPlatform = pkgs.makeRustPlatform {
18      rustc = rustTarget;
19      cargo = rustTarget;
20    };
21  
22    inherits = {
23      inherit
24        inputs
25        craneLib
26        src
27        mkMetric
28        distrox-cli
29        commonCrateArgs
30        rustPlatform
31        iroh-relay
32        ;
33    };
34  
35    crates = callPackage ./crates.nix inherits;
36  
37    cargoDepgraph = callPackage ./cargo-depgraph.nix inherits;
38  
39    depgraph = callPackage ./depgraph.nix (
40      inherits
41      // {
42        inherit cargoDepgraph;
43        inherit (crates) cargoArtifacts;
44      }
45    );
46  
47    depgraph-svg =
48      runCommand "depgraph-to-svg"
49        {
50          buildInputs = [ pkgs.graphviz ];
51        }
52        ''
53          mkdir $out
54          dot -Tsvg ${depgraph}/depgraph.dot > $out/depgraph.svg
55        '';
56  in
57  crates
58  // {
59    config = callPackage ./config.nix inherits;
60    packages = callPackage ./packages.nix inherits;
61    iroh-relay-module = callPackage ./iroh-relay-module.nix inherits;
62    testUtils = callPackage ./test-utils.nix inherits;
63    metric-binary-size = callPackage ./metric-binary-size.nix inherits;
64    metric-derivation-size = callPackage ./metric-derivation-size.nix inherits;
65    mk-metric-test-count = callPackage ./metric-test-count.nix inherits;
66    manpages = callPackage ./manpages.nix inherits // {
67      inherit (crates) distrox-cli;
68    };
69  
70    inherit
71      cargoDepgraph
72      depgraph
73      depgraph-svg
74      ;
75  
76  }