|
38 | 38 | , buildType ? "release" |
39 | 39 | , meta ? {} |
40 | 40 | , useFetchCargoVendor ? false |
| 41 | +, cargoDeps ? null |
41 | 42 | , cargoLock ? null |
42 | 43 | , cargoVendorDir ? null |
43 | 44 | , checkType ? buildType |
|
60 | 61 | , buildAndTestSubdir ? null |
61 | 62 | , ... } @ args: |
62 | 63 |
|
63 | | -assert cargoVendorDir == null && cargoLock == null |
| 64 | +assert cargoVendorDir == null && cargoDeps == null && cargoLock == null |
64 | 65 | -> !(args ? cargoSha256 && args.cargoSha256 != null) && !(args ? cargoHash && args.cargoHash != null) |
65 | | - -> throw "cargoHash, cargoVendorDir, or cargoLock must be set"; |
| 66 | + -> throw "cargoHash, cargoVendorDir, cargoDeps, or cargoLock must be set"; |
66 | 67 |
|
67 | 68 | let |
68 | 69 |
|
69 | | - cargoDeps = |
| 70 | + cargoDeps' = |
70 | 71 | if cargoVendorDir != null then null |
| 72 | + else if cargoDeps != null then cargoDeps |
71 | 73 | else if cargoLock != null then importCargoLock cargoLock |
72 | 74 | else if useFetchCargoVendor then (fetchCargoVendor { |
73 | 75 | inherit src srcs sourceRoot preUnpack unpackPhase postUnpack; |
|
102 | 104 | # See https://os.phil-opp.com/testing/ for more information. |
103 | 105 | assert useSysroot -> !(args.doCheck or true); |
104 | 106 |
|
105 | | -stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoLock" ]) // lib.optionalAttrs useSysroot { |
| 107 | +stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoDeps" "cargoLock" ]) // lib.optionalAttrs useSysroot { |
106 | 108 | RUSTFLAGS = "--sysroot ${sysroot} " + (args.RUSTFLAGS or ""); |
107 | 109 | } // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && buildType == "debug") { |
108 | 110 | RUSTFLAGS = |
109 | 111 | "-C split-debuginfo=packed " |
110 | 112 | + lib.optionalString useSysroot "--sysroot ${sysroot} " |
111 | 113 | + (args.RUSTFLAGS or ""); |
112 | 114 | } // { |
113 | | - inherit buildAndTestSubdir cargoDeps; |
| 115 | + cargoDeps = cargoDeps'; |
| 116 | + inherit buildAndTestSubdir; |
114 | 117 |
|
115 | 118 | cargoBuildType = buildType; |
116 | 119 |
|
|
0 commit comments