How do I best use Nix to create a development environment on an HPC cluster without the possibility of system-wide installation?

If you want to lock down version of programs with a flake (which is a good idea), go with a buildEnv

cat >flake.nix <<EOF
{
  outputs = { self, nixpkgs }: {
    packages.x86_64-linux.default = with nixpkgs.legacyPackages.x86_64-linux; buildEnv {
      name = "project";
      paths = [
        yazi
        btop
      ];
    };
  };
}
EOF

and use nix shell to access it

[tyson@tux:~/example]$ nix shell .#
[tyson@tux:~/example]$ declare -fp | wc -l
2412
[tyson@tux:~/example]$ declare -p | wc -l
126
[tyson@tux:~/example]$ echo $PATH | tr : '\n' | wc -l
9