Someone emulated this
nixpkgs/pkgs/build-support/coq/extra-lib.nix at master · NixOS/nixpkgs (github.com)
/* Emulate a "switch - case" construct,
instead of relying on `if then else if ...` */
/* Usage:
```nix
switch-if [
if-clause-1
..
if-clause-k
] default-out
where a if-clause has the form { cond = b; out = r; }
the first branch such as b
is true */