Rust Setup (Broken Module Config)

I’m trying to setup a rust dev environment in my modules but my config seems to be broken.
I’ts probably some small language syntax problem that I’m missing.

This is the guide from the wiki: Rust - NixOS Wiki

And this is my current failing rustup.nix file:
The main part is from the wiki.

{
  pkgs ? import <nixpkgs> {},
  config,
  lib,
  ...
}: {
  options.blub.shell.rustup = {
    enable = lib.mkEnableOption "install the Rust config";
  };

  config = let
    opts = config.blub.shell.rustup;
    overrides = builtins.fromTOML (builtins.readFile ./rust-toolchain.toml);
    libPath = with pkgs;
      lib.makeLibraryPath [
        # load external libraries that you need in your rust project here
      ];
  in
    lib.mkIf opts.enable {
      pkgs.mkShell rec {
        buildInputs = with pkgs; [
          clang
          # Replace llvmPackages with llvmPackages_X, where X is the latest LLVM version (at the time of writing, 16)
          llvmPackages.bintools
          rustup
        ];
        RUSTC_VERSION = overrides.toolchain.channel;
        # https://github.com/rust-lang/rust-bindgen#environment-variables
        LIBCLANG_PATH = pkgs.lib.makeLibraryPath [pkgs.llvmPackages_latest.libclang.lib];
        shellHook = ''
          export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
          export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
        '';
        # Add precompiled library to rustc search path
        RUSTFLAGS = builtins.map (a: ''-L ${a}/lib'') [
          # add libraries here (e.g. pkgs.libvmi)
        ];
        LD_LIBRARY_PATH = libPath;
        # Add glibc, clang, glib, and other headers to bindgen search path
        BINDGEN_EXTRA_CLANG_ARGS =
          # Includes normal include path
          (builtins.map (a: ''-I"${a}/include"'') [
            # add dev libraries here (e.g. pkgs.libvmi.dev)
            pkgs.glibc.dev
          ])
          # Includes with special directory paths
          ++ [
            ''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
            ''-I"${pkgs.glib.dev}/include/glib-2.0"''
            ''-I${pkgs.glib.out}/lib/glib-2.0/include/''
          ];
      }
    };
}

And this is the error:

error: syntax error, unexpected REC, expecting '.' or '='
       at /nix/store/4cbdaqdg4mn6qnzq6wangvr101jwjbkb-nixos/rustup.nix:20:20:
           19|     lib.mkIf opts.enable {
           20|       pkgs.mkShell rec {
             |                    ^
           21|         buildInputs = with pkgs; [

My current workaround looks like this:

{
  config,
  lib,
  pkgs,
  ...
}: {
  options.blub.shell.rust.enable = lib.mkEnableOption "install the Rust config";

  config = lib.mkIf config.blub.shell.rust.enable {
    home.packages = with pkgs; [
      rustup
    ];
  };
}

To be honest, I’m not sure exactly what pkgs.mkShell rec { does.
Does it create an extra environment that I can launch and it doesn’t matter what else is installed on my system, like nix-shell -p XXX?