Reference another field in attrset

Hi all

I am adding my sway config to nixos configuration and I wanted to reuse the value of the field sway.config.modifier in another place within the conf.
Is used the example from the documentation of home manager (Appendix A. Configuration Options) but I get the following error value is a string with context while a set was expected.

Here is the file:

{ config, pkgs, lib, ... }:
let
  home-manager = builtins.fetchTarball {
    url = "https://github.com/nix-community/home-manager/archive/master.tar.gz";
    sha256 = "sha256:0d68p5bmyppbwwh5d5jzygh1kkpcivdrph591sw5m23kcrcys7zh";
  };
in {
  imports = [
    (import "${home-manager}/nixos")
  ];
  home-manager.useGlobalPkgs = true;
  home-manager.useUserPackages = true;
  home-manager.users.jdoe = {
    programs.zsh.zplug = {
      enable = true;
      plugins = import ../common_zplug_plugins.nix;
    };
   wayland.windowManager.sway = {
      enable = true;
      config = {
        modifier = "Mod4";
        terminal = "foot";
        seat.seat0.xcursor_theme  = "Vimix-white-cursors";
        keybindings =
        let
          modifier = home-manager.users.jdoe.wayland.windowManager.sway.config.modifier;
        in lib.mkOptionDefault
        {
          "${modifier}+Alt+exclam" = "exec ~/.config/rofi/rofimenus.py --menu windows -a \"$rofi-accent-color\"";
        };

        output = {
          "*" = {
            scale = "1.8";
            bg = "/usr/share/backgrounds/background.jpg stretch";
          };
        };
        window = {
          border = 2;
          commands = [
            {
              criteria.class = "TelegramDesktop";
              command = "floating enable";
            }
          ];
        };
        gaps = {
          inner = 2;
          outer = 0;
        };
        fonts = {
          names = [ "NotoSans Nerd Font" ];
          style = "Semibold";
          size = 9.0;
        };
      };
    extraConfig = ''
      titlebar_padding 5 3
    '';
    };
  };
}

Can somebody give me a hints of what I am doing wrong ?

config.home-manager.users.jdoe.wayland.windowManager.sway.config.modifier

Thanks for the answer, that works !