Seeing contents of Network Booted Custom NixOS configs

I’ve been experimenting with network booting using nixos the past couple of days, and I’ve made a simple config that boots and start sm64pc in fullscreen inspired by

{ pkgs, lib, ... }:

  sm64pc = (import <nur> { inherit pkgs; }).repos.ivar.sm64pc;
in {
  environment.systemPackages = with pkgs; [ sm64pc ];

  networking.hostName = "its-a-me";

  users.users.mario = { isNormalUser = true; };
  system.activationScripts = {
    base-dirs = {
      text = ''
        mkdir -p /nix/var/nix/profiles/per-user/mario
      deps = [ ];
  services.cage = {
    enable = true;
    user = "mario";
    program = "${sm64pc}/bin/sm64pc";

  hardware.pulseaudio.enable = true;
  virtualisation.virtualbox.guest.enable = true;
  bootSystem = import <nixpkgs/nixos> {
    # system = ...;

    configuration = { config, pkgs, lib, ... }: with lib; {
      imports = [
      virtualisation.virtualbox.guest.enable = mkForce false;

  pkgs = import <nixpkgs> {};
  pkgs.symlinkJoin {
    name = "netboot";
    paths = with; [
    preferLocalBuild = true;

NIXPKGS_ALLOW_UNFREE=1 nix-build -I nixpkgs=channel:nixos-unstable --out-link /tmp/netboot network.nix

I figured nixos would be very good for making tiny images like this, as there shouldnt be much of anything other than what I put into the config.

It works fine, but the image is 350MB (was like 500MB), to find out what’s using all that space I figured I’d look inside the initrd file.

so I copied and gunzipped it, then ran it through cpio I’m new to network booting in general, but was happy to see a /nix folder. But quickly I saw that it was only filled with busybox binaries, and there was no trace of the packages in the configuration. Not to mention it only amassed to something like 22MB.

If I build an ISO, I can simply unsquash the nix-store.squashfs file and inspect that, which is a nice workaround, but I wonder how I can debug a network image like that.

I guess this could be a linux question more than nixos specific. Thank you in advance!

(Also turns out there’s like 500MB of mesa drivers and locales that can probably be pruned down quite a bit)