X doesn't start after installing nvidia drivers

Before writing this into my config, X starts using my discrete gpu perfectly. But when i added the display manager nor X starts. I have a ryzen 7600 with integrated gpu and a rtx 3070.

  hardware.opengl = {
    enable = true;
  };

  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia = {
    modesetting.enable = true;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    open = false;
    nvidiaSettings = true;
    package = config.boot.kernelPackages.nvidiaPackages.stable;
  };

  hardware.nvidia.prime = {
    offload = {
      enable = true;
      enableOffloadCmd = true;
    };
    amdgpuBusId = "PCI:15:0:0";
    nvidiaBusId = "PCI:1:0:0";
  };

nix-shell -p pciutils --run "lspci -nn | grep VGA"

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA104 [GeForce RTX 3070 Lite Hash Rate] [10de:2488] (rev a1)
0f:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Raphael [1002:164e] (rev c6)

My config:

{ config, lib, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
    ];

  programs.steam.enable = true;

  hardware.opengl = {
    enable = true;
  };

  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia = {
    modesetting.enable = true;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    open = false;
    nvidiaSettings = true;
    package = config.boot.kernelPackages.nvidiaPackages.stable;
  };

  hardware.nvidia.prime = {
    offload = {
      enable = true;
      enableOffloadCmd = true;
    };
    amdgpuBusId = "PCI:15:0:0";
    nvidiaBusId = "PCI:1:0:0";
  };  

  nixpkgs.config.allowUnfree = true;

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "neo";

  time.timeZone = "America/Argentina/Buenos_Aires";

  i18n.defaultLocale = "en_AU.UTF-8";
  console = {
    keyMap = "la-latin1";
  };

  services.xserver.enable = true;

  services.xserver.windowManager.xmonad = {
    enable = true;
    enableContribAndExtras = true;
  };
  
  services.xserver.xkb.layout = "latam";

  hardware.pulseaudio.enable = true;

  users.users.main = {
    isNormalUser = true;
    extraGroups = [ "wheel" ];
  };

  services.locate = {
    enable = true;
    interval = "13:45";
  };

  environment.systemPackages = with pkgs; [
    emacs
    git
    firefox
    xmobar
    ntfs3g
    fuse3
    mangohud
    htop
    scrot
    neovim
    ffmpeg
    mpv
    unzip
    ncdu
    fastfetch
    keepassxc
    xwallpaper
    imv
    lsix
    rofi
    discord
    google-chrome
    imagemagickBig
    libsixel
    yt-dlp
  ];

  fonts.packages = [
    pkgs.spleen
  ];

  nix.settings.allowed-users = [ "root" ];

  systemd.services."alarm" = {
    enable = true;
    startAt = "18:58";
    restartIfChanged = false;
    serviceConfig = {
      Type = "oneshot";
      User = "main";
    };
    path = [ pkgs.pulseaudio ];
    environment.XDG_RUNTIME_DIR = "/run/user/1000";
    script = "paplay /run/current-system/sw/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga";
  };

  systemd.services."shutdown" = {
    enable = false;
    startAt = "19:00";
    restartIfChanged = false;
    serviceConfig = {
      Type = "oneshot";
      User = "root";
    };
    script = "shutdown now";
  };

security.pam.services =
    let accountRequiredTime = pkgs.lib.mkDefault ( pkgs.lib.mkAfter "account required pam_time.so" );
    in {
      login.text = accountRequiredTime;
      sudo.text = accountRequiredTime;
      su.text = accountRequiredTime;
  };

  environment.etc."security/time.conf".text = ''
    #sudo|su;*;*;Al1300-1600
    #login;*;root;Al1300-1600
    #login;*;main;Al1300-1900
  '';

  security.sudo.extraConfig = "Defaults rootpw";

  programs.firefox = {
    enable = true;
    policies = {
      DisableTelemetry = true;
      DisableFirefoxStudies = true;
      DisablePocket = true;
      NoDefaultBookmarks = true;
      DisableAppUpdate = true;
      WebsiteFilter = {
        #Block = [  ];
      };
    };
  };

  system.autoUpgrade = {
    enable = true;
    dates = "13:05";
  };

  nix.gc = {
    automatic = true;
    dates = "13:00";
    options = "--delete-older-than 2d";
  };

  nix.settings.auto-optimise-store = true;

  services.udisks2.enable = true;

  system.stateVersion = "24.05";
}

Xorg error log after installing the drivers and executing startx