This is not the same. I used to do something like what you describe, but it can't get close to the ease and safety of a declarative config: updating the script and updating the current system are two different steps, only one of which is easy to verify (let alone libc or gpu drivers randomly breaking when i try to install a dependency...).
It is possibly worth it if you don't want to go through the nix learning curve, but after you're over that curve the value prop is very different.