Fix a few issues with the current auto-configuration flow for private nix caches:
Track whether or not we've configured ~root/.aws/config in a separate state file in the user's home directory. This lets Devbox know if AWS has already been configured, even if it cannot read root's home directory.
If the user answers no to the sudo confirmation prompt, don't ask them again. This is so we don't pester the user every time they install a package.
Preserve XDG_STATE_HOME in sudo so that we write state files to the correct directory.
Append a timestamp to the ~root/.aws directory when we back it up. This allows multiple backups if the setup process is run more than once.
The logic for saving state around whether or not the cache setup has already run lives in a new setup package. The setup package tracks when a task last ran, what version of Devbox it ran with, and if there was an error. This makes it easier to define tasks that only run once for a user or only occur after an upgrade.
Fix a few issues with the current auto-configuration flow for private nix caches:
The logic for saving state around whether or not the cache setup has already run lives in a new
setup
package. Thesetup
package tracks when a task last ran, what version of Devbox it ran with, and if there was an error. This makes it easier to define tasks that only run once for a user or only occur after an upgrade.