Give each file a clear job.
A module may be a plain attribute set or a function receiving arguments such as config, lib, and pkgs. The imports list brings other modules into the same evaluation; it is not a sequence of shell operations.
Move a small set of related options into tools.nix, then import that file from your existing configuration. The paths are relative to the file that contains them.
# tools.nix
{ pkgs, ... }: {
environment.systemPackages = [ pkgs.git pkgs.hello ];
}
# In configuration.nix
imports = [
./hardware-configuration.nix
./tools.nix
];
Definitions combine by option type.
List-valued options often concatenate. Incompatible definitions for a single-value option usually cause an evaluation error rather than silently choosing whichever file came last.
lib.mkDefault supplies a low-priority default; lib.mkForce overrides ordinary priorities. Use them intentionally. If a conflict is surprising, first look for duplicate definitions instead of immediately forcing a value.
Modules merge declarations. Their import order is not an imperative setup script.