How can I override openssl?

I am trying to replace openssl globally with boringssl, or more specifically aws-lc. I tried making a default.nix with

openssl = pkgs.stdenv.mkDerivation {
  name = "boringssl";
  src = builtins.fetchTarball "":
  nativeBuildInputs = [
  cmakeFlags = ["-GNinja"];

However I get the following error:

(attribute override missing)

I found a somewhat similar issue here replacement of openssl with libressl with a overlay results in evaluation failures · Issue #56994 · NixOS/nixpkgs · GitHub that mentions the same lines, but I can’t find a fix for the override attribute error… Should I report this to nixpkgs on GitHub as a new issue instead?