lixVersions: use fetchCargoVendor

Cargo 1.84.0 seems to have changed the output format of cargo vendor
again, once again invalidating fetchCargoTarball FOD hashes.  It's
time to fix this once and for all, switching across the board to
fetchCargoVendor, which is not dependent on cargo vendor's output
format.

I've unified the cargoHash and cargoLock parameters into a single
cargoDeps parameter, which is what cargoHash and cargoLock end up
being shorthand for.  Taking a cargoHash parameter for a package
builder isn't generally a good idea, because it will produce a
silently broken FOD if we change the hashing scheme, like we're doing
here.  For Lix this wouldn't be too bad currently because lix-doc
isn't exposed and so can't be overridden, but I think this is still
cleaner than having two mutually exclusive parameters passed through
multiple layers of functions.
This commit is contained in:
Alyssa Ross
2025-01-31 13:59:36 +01:00
parent 73219503af
commit 79187e681c
3 changed files with 37 additions and 25 deletions
+4 -15
View File
@@ -1,21 +1,13 @@
{
lib,
fetchFromGitHub,
version,
suffix ? "",
hash ? null,
src ? fetchFromGitHub {
owner = "lix-project";
repo = "lix";
rev = version;
inherit hash;
},
docCargoHash ? null,
docCargoLock ? null,
version,
src,
docCargoDeps,
patches ? [ ],
maintainers ? lib.teams.lix.members,
}@args:
assert (hash == null) -> (src != null);
{
stdenv,
meson,
@@ -60,8 +52,7 @@ assert (hash == null) -> (src != null);
lix-doc ? callPackage ./doc {
inherit src;
version = "${version}${suffix}";
cargoHash = docCargoHash;
cargoLock = docCargoLock;
cargoDeps = docCargoDeps;
},
enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform,
@@ -76,8 +67,6 @@ assert (hash == null) -> (src != null);
stateDir,
storeDir,
}:
assert lib.assertMsg (docCargoHash != null || docCargoLock != null)
"Either `lix-doc`'s cargoHash using `docCargoHash` or `lix-doc`'s `cargoLock.lockFile` using `docCargoLock` must be set!";
let
isLegacyParser = lib.versionOlder version "2.91";
in
+31 -6
View File
@@ -5,6 +5,7 @@
callPackage,
fetchFromGitHub,
fetchpatch,
rustPlatform,
Security,
storeDir ? "/nix/store",
@@ -54,18 +55,42 @@ lib.makeExtensible (self: {
buildLix = common;
lix_2_90 = (
common {
common rec {
version = "2.90.0";
hash = "sha256-f8k+BezKdJfmE+k7zgBJiohtS3VkkriycdXYsKOm3sc=";
docCargoHash = "sha256-vSf9MyD2XzofZlbzsmh6NP69G+LiX72GX4Um9UJp3dc=";
src = fetchFromGitHub {
owner = "lix-project";
repo = "lix";
rev = version;
hash = "sha256-f8k+BezKdJfmE+k7zgBJiohtS3VkkriycdXYsKOm3sc=";
};
docCargoDeps = rustPlatform.fetchCargoVendor {
name = "lix-doc-${version}";
inherit src;
sourceRoot = "${src.name or src}/lix-doc";
hash = "sha256-VPcrf78gfLlkTRrcbLkPgLOk0o6lsOJBm6HYLvavpNU=";
};
}
);
lix_2_91 = (
common {
common rec {
version = "2.91.1";
hash = "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=";
docCargoHash = "sha256-F6Ld0HfRvW9r5zn8eMTP6djnV/jvwjYQet4Ghp2T90k=";
src = fetchFromGitHub {
owner = "lix-project";
repo = "lix";
rev = version;
hash = "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=";
};
docCargoDeps = rustPlatform.fetchCargoVendor {
name = "lix-doc-${version}";
inherit src;
sourceRoot = "${src.name or src}/lix-doc";
hash = "sha256-U820gvcbQIBaFr2OWPidfFIDXycDFGgXX1NpWDDqENs=";
};
}
);
@@ -2,8 +2,7 @@
src,
rustPlatform,
version,
cargoHash ? null,
cargoLock ? null,
cargoDeps,
}:
rustPlatform.buildRustPackage {
@@ -12,7 +11,6 @@ rustPlatform.buildRustPackage {
inherit
version
src
cargoHash
cargoLock
cargoDeps
;
}