Auditing system packages

I am building an sd_image for a raspberry pi and noticing a lot of unexpected output while running nix-build. For example I see building '/nix/store/59j9wz1zcib8i044xry5kqi4wfnxhrrn-xscreensaver.pam.drv but I am building a headless/minimal setup.

I am wondering how I can list/output all of the packages that are being included in the final image. The official image from raspberry pi seems quite a bit smaller than the output produced from this build as well.

Here is a snipet of my setup:

build-sd.nix:

{ targetName }:
let 
  moduleArgs = {
    _module.args = {
      inherit targetName;
    };
  };
  sandbox = false;
  nixos-config = ./config/sd-image.nix;
  evalutedConfig = (import <nixpkgs/nixos/lib/eval-config.nix> {
    system = "aarch64-linux";
    modules = [
      moduleArgs
      ./sd-image.nix
    ];
  });
in
  evalutedConfig.config.system.build.sdImage

sd-image.nix

{ 
config,
pkgs,
lib,
targetName,
...
}:
with lib;
let 
in
{
  imports = [
    ./configuration.nix
    <nixpkgs/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix>
    <nixpkgs/nixos/modules/profiles/minimal.nix>
    <nixpkgs/nixos/modules/profiles/minimal.nix>
  ];

    targetName = mkOption {
      default = "${targetName}";
      description = lib.mdDoc ''
       Name of the target
      '';
    };
  };

  config = {
    system.stateVersion = "23.11";

    sdImage.compressImage = false;
  };
...

And I’m evoking this with:
nix-build -I nixos-config=./config/configuration.nix --argstr targetName pi /config/config/build-sd.nix

nix-tree is usually what I reach for first.

Thank you! This was extremely helpful.