-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCargo.nix
70 lines (67 loc) · 2.35 KB
/
Cargo.nix
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
60
61
62
63
64
65
66
67
68
69
70
# This file was @generated by cargo2nix 0.11.0.
# It is not intended to be manually edited.
args@{
release ? true,
rootFeatures ? [
"utils/default"
"cli/default"
],
rustPackages,
buildRustPackages,
hostPlatform,
hostPlatformCpu ? null,
hostPlatformFeatures ? [],
target ? null,
codegenOpts ? null,
profileOpts ? null,
cargoUnstableFlags ? null,
rustcLinkFlags ? null,
rustcBuildFlags ? null,
mkRustCrate,
rustLib,
lib,
workspaceSrc,
ignoreLockHash,
}:
let
nixifiedLockHash = "e1174dd2490db7bebb5095bd9a33dae53aa22730bb5a9f6514c4cebc093fd14e";
workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc;
currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock);
lockHashIgnored = if ignoreLockHash
then builtins.trace "Ignoring lock hash" ignoreLockHash
else ignoreLockHash;
in if !lockHashIgnored && (nixifiedLockHash != currentLockHash) then
throw ("Cargo.nix ${nixifiedLockHash} is out of sync with Cargo.lock ${currentLockHash}")
else let
inherit (rustLib) fetchCratesIo fetchCrateLocal fetchCrateGit fetchCrateAlternativeRegistry expandFeatures decideProfile genDrvsByProfile;
profilesByName = {
};
rootFeatures' = expandFeatures rootFeatures;
overridableMkRustCrate = f:
let
drvs = genDrvsByProfile profilesByName ({ profile, profileName }: mkRustCrate ({ inherit release profile hostPlatformCpu hostPlatformFeatures target profileOpts codegenOpts cargoUnstableFlags rustcLinkFlags rustcBuildFlags; } // (f profileName)));
in { compileMode ? null, profileName ? decideProfile compileMode release }:
let drv = drvs.${profileName}; in if compileMode == null then drv else drv.override { inherit compileMode; };
in
{
cargo2nixVersion = "0.11.0";
workspace = {
utils = rustPackages.unknown.utils."0.1.0";
cli = rustPackages.unknown.cli."0.1.0";
};
"unknown".cli."0.1.0" = overridableMkRustCrate (profileName: rec {
name = "cli";
version = "0.1.0";
registry = "unknown";
src = fetchCrateLocal workspaceSrc;
dependencies = {
utils = (rustPackages."unknown".utils."0.1.0" { inherit profileName; }).out;
};
});
"unknown".utils."0.1.0" = overridableMkRustCrate (profileName: rec {
name = "utils";
version = "0.1.0";
registry = "unknown";
src = fetchCrateLocal workspaceSrc;
});
}