Skip to content

Commit 7baa9f1

Browse files
authored
libdeltachat: use fetchCargoVendor (#357358)
2 parents 89b870b + b859583 commit 7baa9f1

File tree

6 files changed

+16
-3255
lines changed

6 files changed

+16
-3255
lines changed

pkgs/build-support/rust/build-rust-package/default.nix

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
, buildType ? "release"
3939
, meta ? {}
4040
, useFetchCargoVendor ? false
41+
, cargoDeps ? null
4142
, cargoLock ? null
4243
, cargoVendorDir ? null
4344
, checkType ? buildType
@@ -60,14 +61,15 @@
6061
, buildAndTestSubdir ? null
6162
, ... } @ args:
6263

63-
assert cargoVendorDir == null && cargoLock == null
64+
assert cargoVendorDir == null && cargoDeps == null && cargoLock == null
6465
-> !(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";
6667

6768
let
6869

69-
cargoDeps =
70+
cargoDeps' =
7071
if cargoVendorDir != null then null
72+
else if cargoDeps != null then cargoDeps
7173
else if cargoLock != null then importCargoLock cargoLock
7274
else if useFetchCargoVendor then (fetchCargoVendor {
7375
inherit src srcs sourceRoot preUnpack unpackPhase postUnpack;
@@ -102,15 +104,16 @@ in
102104
# See https://os.phil-opp.com/testing/ for more information.
103105
assert useSysroot -> !(args.doCheck or true);
104106

105-
stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoLock" ]) // lib.optionalAttrs useSysroot {
107+
stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoDeps" "cargoLock" ]) // lib.optionalAttrs useSysroot {
106108
RUSTFLAGS = "--sysroot ${sysroot} " + (args.RUSTFLAGS or "");
107109
} // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && buildType == "debug") {
108110
RUSTFLAGS =
109111
"-C split-debuginfo=packed "
110112
+ lib.optionalString useSysroot "--sysroot ${sysroot} "
111113
+ (args.RUSTFLAGS or "");
112114
} // {
113-
inherit buildAndTestSubdir cargoDeps;
115+
cargoDeps = cargoDeps';
116+
inherit buildAndTestSubdir;
114117

115118
cargoBuildType = buildType;
116119

pkgs/by-name/de/deltachat-repl/package.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
rustPlatform.buildRustPackage {
77
pname = "deltachat-repl";
88

9-
inherit (libdeltachat) version src cargoLock buildInputs;
9+
inherit (libdeltachat) version src cargoDeps buildInputs;
1010

1111
nativeBuildInputs = [
1212
pkg-config

pkgs/by-name/de/deltachat-rpc-server/package.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
rustPlatform.buildRustPackage {
77
pname = "deltachat-rpc-server";
88

9-
inherit (libdeltachat) version src cargoLock buildInputs;
9+
inherit (libdeltachat) version src cargoDeps buildInputs;
1010

1111
nativeBuildInputs = [
1212
pkg-config

pkgs/by-name/li/libdeltachat/package.nix

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,7 @@
1818
, libiconv
1919
}:
2020

21-
let
22-
cargoLock = {
23-
lockFile = ./Cargo.lock;
24-
outputHashes = {
25-
"email-0.0.20" = "sha256-rV4Uzqt2Qdrfi5Ti1r+Si1c2iW1kKyWLwOgLkQ5JGGw=";
26-
"encoded-words-0.2.0" = "sha256-KK9st0hLFh4dsrnLd6D8lC6pRFFs8W+WpZSGMGJcosk=";
27-
"lettre-0.9.2" = "sha256-+hU1cFacyyeC9UGVBpS14BWlJjHy90i/3ynMkKAzclk=";
28-
};
29-
};
30-
in stdenv.mkDerivation rec {
21+
stdenv.mkDerivation rec {
3122
pname = "libdeltachat";
3223
version = "1.148.7";
3324

@@ -42,7 +33,11 @@ in stdenv.mkDerivation rec {
4233
./no-static-lib.patch
4334
];
4435

45-
cargoDeps = rustPlatform.importCargoLock cargoLock;
36+
cargoDeps = rustPlatform.fetchCargoVendor {
37+
pname = "deltachat-core-rust";
38+
inherit version src;
39+
hash = "sha256-eDj8DIvvWWj+tfHuzR35WXlKY5klGxW+MixdN++vugk=";
40+
};
4641

4742
nativeBuildInputs = [
4843
cmake
@@ -78,7 +73,6 @@ in stdenv.mkDerivation rec {
7873
'';
7974

8075
passthru = {
81-
inherit cargoLock;
8276
tests = {
8377
inherit deltachat-desktop deltachat-repl deltachat-rpc-server;
8478
python = python3.pkgs.deltachat;

0 commit comments

Comments
 (0)