You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There have been several proposals for handling failures for backup of files stopping the home-manager activation, because there is a need in special cases which can not be solved with e.g. forcing overwrite for a single specified file. Unfortunately it seems that there is no consensus how to deal with that error case: setting a global force-overwrite flag was considered too risky because something important could be deleted (by intended or even unintended behaviour).
My proposal is to give that decision to a user defined optional error handling script with an option like home-manager.backupFileExistsHook. This bash script should be executed in case of "backup file already exists" and two environment variables (e.g. ORIGINALFILE, BACKUPFILE) should be set. Then the user can define any strategy wanted (from renaming the backups with dates in the filname to moving with overwriting). If the script returns no error and made space for writing a new file in the place of "ORIGINALFILE" the home-manager activation can continue. If no script is set at all, same backward compatible behaviour of immediate failure.
The text was updated successfully, but these errors were encountered:
Description
There have been several proposals for handling failures for backup of files stopping the home-manager activation, because there is a need in special cases which can not be solved with e.g. forcing overwrite for a single specified file. Unfortunately it seems that there is no consensus how to deal with that error case: setting a global force-overwrite flag was considered too risky because something important could be deleted (by intended or even unintended behaviour).
My proposal is to give that decision to a user defined optional error handling script with an option like home-manager.backupFileExistsHook. This bash script should be executed in case of "backup file already exists" and two environment variables (e.g. ORIGINALFILE, BACKUPFILE) should be set. Then the user can define any strategy wanted (from renaming the backups with dates in the filname to moving with overwriting). If the script returns no error and made space for writing a new file in the place of "ORIGINALFILE" the home-manager activation can continue. If no script is set at all, same backward compatible behaviour of immediate failure.
The text was updated successfully, but these errors were encountered: