WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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
For some time, home-manager has been able to move configuration files out of the way as backups (for example, to a path with a .bak extension added). While this works the first time a managed configuration file replaces an existing file, it has a couple of downsides.
First, it litters the filesystem with .bak files that go stale very quickly. They're likely handy for a week or two at most, if the HM replacement doesn't quite do what you wanted. After that, they're just cruft.
Second, (and perhaps I'm peculiar in this workflow), one might make a "live" copy of a configuration to test out immediate changes, and then update HM accordingly. The subsequent home-manager switch would update the configuration... unless there's already a backup file, in which case it conservatively refuses to clobber the backup.
As the original contributor of the backup feature, I've been thinking about these issues on and off for a while now (and seeing frustration in the issues here as backups became part of the NixOS module).
Would it be possible for home-manager to keep a record of the backups it's made? If for example there were a list of paths and digests, maybe in $XDG_STATE_HOME, then there might be a home-manager clean-backups that goes through the list, deleting any unchanged files. It might also be an optional pre-switch step, which could be enabled by a flag on the command line or an option in the module.
My biggest question is: is it appropriate for home-manager to set up such a state file, or is there an existing location that would be better?
@rycee@khaneliman - this feels like a (small) architectural question, so I'd love your input.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
For some time, home-manager has been able to move configuration files out of the way as backups (for example, to a path with a
.bakextension added). While this works the first time a managed configuration file replaces an existing file, it has a couple of downsides.First, it litters the filesystem with
.bakfiles that go stale very quickly. They're likely handy for a week or two at most, if the HM replacement doesn't quite do what you wanted. After that, they're just cruft.Second, (and perhaps I'm peculiar in this workflow), one might make a "live" copy of a configuration to test out immediate changes, and then update HM accordingly. The subsequent
home-manager switchwould update the configuration... unless there's already a backup file, in which case it conservatively refuses to clobber the backup.As the original contributor of the backup feature, I've been thinking about these issues on and off for a while now (and seeing frustration in the issues here as backups became part of the NixOS module).
Would it be possible for home-manager to keep a record of the backups it's made? If for example there were a list of paths and digests, maybe in
$XDG_STATE_HOME, then there might be ahome-manager clean-backupsthat goes through the list, deleting any unchanged files. It might also be an optional pre-switch step, which could be enabled by a flag on the command line or an option in the module.My biggest question is: is it appropriate for home-manager to set up such a state file, or is there an existing location that would be better?
@rycee @khaneliman - this feels like a (small) architectural question, so I'd love your input.
Beta Was this translation helpful? Give feedback.
All reactions