|
48 | 48 | version = versions.stacks_node_version; |
49 | 49 |
|
50 | 50 | # Common arguments can be set here to avoid repeating them later |
51 | | - commonArgs = { |
| 51 | + baseArgs = { |
52 | 52 | strictDeps = true; |
53 | 53 |
|
54 | 54 | buildInputs = |
|
59 | 59 | # Darwin specific inputs |
60 | 60 | pkgs.darwin.apple_sdk.frameworks.SystemConfiguration |
61 | 61 | ]; |
| 62 | + |
| 63 | + src = fileSetForCrate ../..; |
| 64 | + inherit version; |
| 65 | + }; |
| 66 | + |
| 67 | + isClarityWASM = p: lib.hasPrefix "git+https://github.com/stacks-network/clarity-wasm.git" p.source; |
| 68 | + |
| 69 | + cargoVendorDir = craneLib.vendorCargoDeps ( |
| 70 | + baseArgs |
| 71 | + // { |
| 72 | + # Use this function to override crates coming from git dependencies |
| 73 | + overrideVendorGitCheckout = |
| 74 | + ps: drv: |
| 75 | + if lib.any (p: isClarityWASM p) ps then |
| 76 | + drv.overrideAttrs (_old: { |
| 77 | + patches = [ |
| 78 | + (builtins.fetchurl { |
| 79 | + url = "https://github.com/stacks-network/clarity-wasm/pull/627.patch"; |
| 80 | + sha256 = "sha256:161mx1m21770lrsc2lfqlwzyydhy8f9bc7pmqb26rcki7s2ar31r"; |
| 81 | + }) |
| 82 | + ]; |
| 83 | + }) |
| 84 | + else |
| 85 | + # Nothing to change, leave the derivations as is |
| 86 | + drv; |
| 87 | + |
| 88 | + # Use this function to override crates coming from any registry checkout |
| 89 | + overrideVendorCargoPackage = p: drv: drv; |
| 90 | + } |
| 91 | + ); |
| 92 | + |
| 93 | + commonArgs = baseArgs // { |
| 94 | + inherit cargoVendorDir; |
62 | 95 | }; |
63 | 96 |
|
64 | 97 | # Build *just* the cargo dependencies, so we can reuse |
65 | 98 | # all of that work (e.g. via cachix) when running in CI |
66 | 99 | cargoArtifacts = craneLib.buildDepsOnly ( |
67 | 100 | commonArgs |
68 | 101 | // { |
69 | | - inherit version; |
70 | 102 | pname = name; |
71 | | - src = fileSetForCrate ../..; |
| 103 | + dummySrc = commonArgs.src; |
72 | 104 | } |
73 | 105 | ); |
74 | 106 |
|
|
85 | 117 | lib.fileset.toSource { |
86 | 118 | root = ../..; |
87 | 119 | fileset = lib.fileset.unions [ |
88 | | - ../../Cargo.toml |
89 | | - ../../Cargo.lock |
| 120 | + (craneLib.fileset.commonCargoSources ../..) |
| 121 | + (craneLib.fileset.configToml ../..) |
90 | 122 | # |
91 | 123 | ../../versions.toml |
92 | 124 | # |
|
154 | 186 | with pkgs; |
155 | 187 | { |
156 | 188 | packages = { |
157 | | - inherit stacks-signer stacks-common; |
| 189 | + inherit stacks-signer stacks-common cargoArtifacts stacks-core; |
158 | 190 | default = stacks-core; |
159 | 191 | }; |
160 | 192 |
|
|
0 commit comments