Skip to content

Commit

Permalink
lixVersions: use fetchCargoVendor
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alyssais committed Jan 31, 2025
1 parent 7321950 commit 79187e6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 25 deletions.
19 changes: 4 additions & 15 deletions pkgs/tools/package-management/lix/common.nix
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
37 changes: 31 additions & 6 deletions pkgs/tools/package-management/lix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
callPackage,
fetchFromGitHub,
fetchpatch,
rustPlatform,
Security,

storeDir ? "/nix/store",
Expand Down Expand Up @@ -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=";
};
}
);

Expand Down
6 changes: 2 additions & 4 deletions pkgs/tools/package-management/lix/doc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
src,
rustPlatform,
version,
cargoHash ? null,
cargoLock ? null,
cargoDeps,
}:

rustPlatform.buildRustPackage {
Expand All @@ -12,7 +11,6 @@ rustPlatform.buildRustPackage {
inherit
version
src
cargoHash
cargoLock
cargoDeps
;
}

0 comments on commit 79187e6

Please sign in to comment.