Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions pkgs/build-support/rust/build-rust-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
, buildType ? "release"
, meta ? {}
, useFetchCargoVendor ? false
, cargoDeps ? null
, cargoLock ? null
, cargoVendorDir ? null
, checkType ? buildType
Expand All @@ -60,14 +61,15 @@
, buildAndTestSubdir ? null
, ... } @ args:

assert cargoVendorDir == null && cargoLock == null
assert cargoVendorDir == null && cargoDeps == null && cargoLock == null
-> !(args ? cargoSha256 && args.cargoSha256 != null) && !(args ? cargoHash && args.cargoHash != null)
-> throw "cargoHash, cargoVendorDir, or cargoLock must be set";
-> throw "cargoHash, cargoVendorDir, cargoDeps, or cargoLock must be set";

let

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

stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoLock" ]) // lib.optionalAttrs useSysroot {
stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoDeps" "cargoLock" ]) // lib.optionalAttrs useSysroot {
RUSTFLAGS = "--sysroot ${sysroot} " + (args.RUSTFLAGS or "");
} // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && buildType == "debug") {
RUSTFLAGS =
"-C split-debuginfo=packed "
+ lib.optionalString useSysroot "--sysroot ${sysroot} "
+ (args.RUSTFLAGS or "");
} // {
inherit buildAndTestSubdir cargoDeps;
cargoDeps = cargoDeps';
inherit buildAndTestSubdir;

cargoBuildType = buildType;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/de/deltachat-repl/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
rustPlatform.buildRustPackage {
pname = "deltachat-repl";

inherit (libdeltachat) version src cargoLock buildInputs;
inherit (libdeltachat) version src cargoDeps buildInputs;

nativeBuildInputs = [
pkg-config
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/de/deltachat-rpc-server/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
rustPlatform.buildRustPackage {
pname = "deltachat-rpc-server";

inherit (libdeltachat) version src cargoLock buildInputs;
inherit (libdeltachat) version src cargoDeps buildInputs;

nativeBuildInputs = [
pkg-config
Expand Down
18 changes: 6 additions & 12 deletions pkgs/by-name/li/libdeltachat/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@
, libiconv
}:

let
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"email-0.0.20" = "sha256-rV4Uzqt2Qdrfi5Ti1r+Si1c2iW1kKyWLwOgLkQ5JGGw=";
"encoded-words-0.2.0" = "sha256-KK9st0hLFh4dsrnLd6D8lC6pRFFs8W+WpZSGMGJcosk=";
"lettre-0.9.2" = "sha256-+hU1cFacyyeC9UGVBpS14BWlJjHy90i/3ynMkKAzclk=";
};
};
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "libdeltachat";
version = "1.148.7";

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

cargoDeps = rustPlatform.importCargoLock cargoLock;
cargoDeps = rustPlatform.fetchCargoVendor {
pname = "deltachat-core-rust";
inherit version src;
hash = "sha256-eDj8DIvvWWj+tfHuzR35WXlKY5klGxW+MixdN++vugk=";
};

nativeBuildInputs = [
cmake
Expand Down Expand Up @@ -78,7 +73,6 @@ in stdenv.mkDerivation rec {
'';

passthru = {
inherit cargoLock;
tests = {
inherit deltachat-desktop deltachat-repl deltachat-rpc-server;
python = python3.pkgs.deltachat;
Expand Down
Loading