libdeltachat: use fetchCargoVendor (#357358)

This commit is contained in:
Masum Reza 2024-11-22 23:25:24 +05:30 committed by GitHub
commit 7baa9f1e15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 16 additions and 3255 deletions

View File

@ -38,6 +38,7 @@
, buildType ? "release"
, meta ? {}
, useFetchCargoVendor ? false
, cargoDeps ? null
, cargoLock ? null
, cargoVendorDir ? null
, checkType ? buildType
@ -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;
@ -102,7 +104,7 @@ 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 =
@ -110,7 +112,8 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
+ lib.optionalString useSysroot "--sysroot ${sysroot} "
+ (args.RUSTFLAGS or "");
} // {
inherit buildAndTestSubdir cargoDeps;
cargoDeps = cargoDeps';
inherit buildAndTestSubdir;
cargoBuildType = buildType;

View File

@ -6,7 +6,7 @@
rustPlatform.buildRustPackage {
pname = "deltachat-repl";
inherit (libdeltachat) version src cargoLock buildInputs;
inherit (libdeltachat) version src cargoDeps buildInputs;
nativeBuildInputs = [
pkg-config

View File

@ -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

View File

@ -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";
@ -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
@ -78,7 +73,6 @@ in stdenv.mkDerivation rec {
'';
passthru = {
inherit cargoLock;
tests = {
inherit deltachat-desktop deltachat-repl deltachat-rpc-server;
python = python3.pkgs.deltachat;

File diff suppressed because it is too large Load Diff

View File

@ -30,8 +30,6 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-8ciA1FoGdnU+GWRcYJc8zU2FpUgGwTZSZynvAi1luYo=";
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
meta = with lib; {
homepage = "https://github.com/akiomik/nostui";
description = "TUI client for Nostr";