Nix-darwin, home-manager, and flakes: how to set environment variables for the main user?

With a nix flake using nix-darwin and home-manager, how can I set environment variables for the main user (me) ?

Here’s a few attributes I’ve found in several examples on github:
They don’t seem to set any environment variables (even after restarting a new shell).
The shell I use is either bash or zsh if that matters.

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    home-manager.url = "github:nix-community/home-manager";
    utils.url = "github:numtide/flake-utils";
    darwin.url = "github:lnl7/nix-darwin";
  };

  outputs = inputs@{ self, nixpkgs, darwin, utils, home-manager }:
    (utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; };
        username = "me";
      in

      {
        defaultPackage = pkgs.writeScriptBin "mksys" ''
          nix --extra-experimental-features nix-command --extra-experimental-features flakes build .#darwinConfigurations.mac2015.system --impure
          # ./result/sw/bin/darwin-rebuild switch --flake .#mac2015 --impure
        '';

        packages = {
          darwinConfigurations.mac2015 = darwin.lib.darwinSystem {
            inherit system;
            modules = [
              ({ pkgs, lib, config, options, ... }:
                {
                  home-manager.users."${username}" = {
                    home.sessionVariables = {
                      EXAMPLE_VAR = "6yuifhjbdsk";
                    };
                  };


                  environment.variables = {
                    EXAMPLE_VAR = "dhjakfhds";
                  };
                  environment.extraInit = with lib;
                    concatStringsSep "\n"
                      (mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.environment.variables);


                  # This seems to be nixOS-specific
                  # environment.sessionVariables = {
                  #   EXAMPLE_VAR = "798yfhudjksfh";
                  # };
                })

              home-manager.darwinModules.home-manager
              {
                users.users.${username}.home = "/Users/${username}";
                home-manager.users.${username} = {
                  imports = [
                    {
                      home = {
                        inherit username;
                        homeDirectory = "/Users/${username}";
                        stateVersion = "23.05";
                      };
                      programs.home-manager.enable = true;
                    }
                  ];
                };
              }
            ];
          };
        };

      }
    ));
}

I am trying to use environment.variables option and it seems like it does not work.

Also this influences programs.direnv.silent option since it relies on env vars as well to set DIRENV_LOG_FORMAT.