Auto-update packages in buildEnv declarated in nixos

I want to install python with some packages globally, and then I find python3.withPackages and buildEnv.

But I find that nix-env cannot update the packages in it automatically because it only compares python3’s version. And I find a option with upgrade named -leq which can do what I want to.

Now, If I declarate it in environment.systemPackages, how to let nixos-rebuild to update packages in it?
And how to let nixos-rebuild to update packages defining in bundlerEnv(ruby) automatically?
And how to let nixos-rebuild to update packages defining in buildEnv automatically?

I find that nixos-rubild using nix-build to rebuild the system not using nix-env, so buildEnv declarted in configuration will be built/upgraded everytime rebuild system