Ways to install packages in configuration.nix

I just installed NixOS for the first yesterday and noticed that Firefox appears to have been installed by default (when using the Graphical ISO image).

In my /etc/nixos/configuration.nix file, why was Firefox installed via:

programs.firefox.enable = true;

rather than:

environment.systemPackages = with pkgs; [
	 firefox
  ];

I also see that there is a commented out line that appears to install Thunderbird this way:

  users.users.samir = {
    isNormalUser = true;
    description = "samir";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
    #  thunderbird
    ];
  };

What is the difference between installing a program or packages using these methods?

systemPackages is often the last resort, prefer using the .enable options for most programs.
You can use the NixOS Search interface to see the code where the option is defined and decide if you want to use it.

and systemPackages will use environment.pathsToLink, user package lists won’t.

Thank you for the quick reply. I will move any applications I find under under the NixOS options search to a separate section in my configuration.nix file, e.g.:

programs.firefox.enable = true;
programs.git.enable = true;
programs.vim.enable = true;

I didn’t even notice the “NixOS” options tab in the search. I had just been searching for “Packages” apparently.