As I just got into this issue and needed to got into the source code of
nixos-rebuild, it turns out that if a
/etc/nixos/flake.nix is created, then nix will automatically switch to flake, trying to build the host matching the current hostname.
So I wanted to document somewhere: how to force
nixos-rebuild switch to use the legacy nix mode?