From 88fe1fe9ec34a05bc262fb5b30dd1b77dd88ac0b Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 18 Oct 2021 16:23:44 -0400 Subject: [PATCH] angelfish: Break build on partial updates The hardcoded cargo hash could have been left unchanged on package updates. By breaking the build explicitly we ensure partial updates won't accidentally slip past us. --- pkgs/applications/plasma-mobile/angelfish.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/plasma-mobile/angelfish.nix b/pkgs/applications/plasma-mobile/angelfish.nix index 29d511d85f8b..99df3f55c1d5 100644 --- a/pkgs/applications/plasma-mobile/angelfish.nix +++ b/pkgs/applications/plasma-mobile/angelfish.nix @@ -17,15 +17,28 @@ , qtwebengine , rustPlatform , srcs + +# These must be updated in tandem with package updates. +, cargoShaForVersion ? "21.08" +, cargoSha256 ? "1pbvw9hdzn3i97mahdy9y6jnjsmwmjs3lxfz7q6r9r10i8swbkak" }: +# Guard against incomplete updates. +# Values are provided as callPackage inputs to enable easier overrides through overlays. +if cargoShaForVersion != srcs.angelfish.version +then builtins.throw '' + angelfish package update is incomplete. + Hash for cargo dependencies is declared for version ${cargoShaForVersion}, but we're building ${srcs.angelfish.version}. + Update the cargoSha256 and cargoShaForVersion for angelfish. +'' else + mkDerivation rec { pname = "angelfish"; cargoDeps = rustPlatform.fetchCargoTarball { src = srcs.angelfish.src; name = "${pname}-${srcs.angelfish.version}"; - sha256 = "1pbvw9hdzn3i97mahdy9y6jnjsmwmjs3lxfz7q6r9r10i8swbkak"; + sha256 = cargoSha256; }; nativeBuildInputs = [