How canI libgfortran together with gfortran?

I have installed nixos.gfortran, but when I compile a f90 program with -lgfortran, it complains that it cannot find this lib.
I have tried gfortran.lib gfortran.dev in default.nix, but neigher can be recognized.

I found that libgfortran exists in my nix/store:

/nix/store/zmj4mkv32vpi9d9ips1fhgjlppjziknw-gfortran-7.4.0-lib/lib

But I don’t know how to add it into my default.nix.

Thanks.

gfortran is a compiler wrapper around gcc.
You can access the unwrapped version through the .cc attribute.
If you add gfortran.cc to buildInputs this will add libgfortran to your compiler link path:

# save as shell.nix
with import <nixpkgs> {};
stdenv.mkDerivation {
  name = "env";
  buildInputs = [
    gfortran
    gfortran.cc
  ];
}
$ nix-shell
$ echo "int main() {}" > main.c
$ gcc -lgfortran -o main main.c