From 1cabb1c445f8d535f66fa949362b973832f2ea2f Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 14 Sep 2023 17:30:52 +0000 Subject: [PATCH] tests/stdenv: Check derivations with an MD5 `outputHash` fail to evaluate --- pkgs/test/stdenv/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/test/stdenv/default.nix b/pkgs/test/stdenv/default.nix index 0fa87cccc219..3882eb2b625c 100644 --- a/pkgs/test/stdenv/default.nix +++ b/pkgs/test/stdenv/default.nix @@ -142,6 +142,15 @@ in ''; }; + # Check that mkDerivation rejects MD5 hashes + rejectedHashes = lib.recurseIntoAttrs { + md5 = + let drv = runCommand "md5 outputHash rejected" { + outputHash = "md5-fPt7dxVVP7ffY3MxkQdwVw=="; + } "true"; + in assert !(builtins.tryEval drv).success; {}; + }; + test-inputDerivation = let inherit (stdenv.mkDerivation { dep1 = derivation { name = "dep1"; builder = "/bin/sh"; args = [ "-c" ": > $out" ]; system = builtins.currentSystem; };