Include nix dependency twice with different arguments

I have a library packaged with nix that can either build a static or dynamic version of itself. What I'd like to do is essentially this:

buildInputs = [
  pkgs.somePackage
  (pkgs.somePackage.override {
    useStaticVersion = true;
  )}
];

Is this possible?