From 79187e681cbdfd8c4ef90de90cdd0be68337c810 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 28 Jan 2025 10:56:35 +0100 Subject: [PATCH] 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. --- pkgs/tools/package-management/lix/common.nix | 19 ++-------- pkgs/tools/package-management/lix/default.nix | 37 ++++++++++++++++--- .../package-management/lix/doc/default.nix | 6 +-- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/pkgs/tools/package-management/lix/common.nix b/pkgs/tools/package-management/lix/common.nix index 19c7ddc58833..7fb40b11776c 100644 --- a/pkgs/tools/package-management/lix/common.nix +++ b/pkgs/tools/package-management/lix/common.nix @@ -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 diff --git a/pkgs/tools/package-management/lix/default.nix b/pkgs/tools/package-management/lix/default.nix index 4a100c337ffb..1acc5e2efb48 100644 --- a/pkgs/tools/package-management/lix/default.nix +++ b/pkgs/tools/package-management/lix/default.nix @@ -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="; + }; } ); diff --git a/pkgs/tools/package-management/lix/doc/default.nix b/pkgs/tools/package-management/lix/doc/default.nix index 994310931e7d..3e61dc917579 100644 --- a/pkgs/tools/package-management/lix/doc/default.nix +++ b/pkgs/tools/package-management/lix/doc/default.nix @@ -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 ; }