Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/snapper: improve config example #109607

Merged
merged 1 commit into from Jan 17, 2021

Conversation

alesya-h
Copy link
Member

Motivation for this change

In the default snapper module configuration we have timers for creating and deleting snapper snapshots, and it looks like if we just create configs with correct mountpoints we will get automatic snapshots. This either used to be true, or seems to be only true on Archlinux according to their wiki: https://wiki.archlinux.org/index.php/Snapper#Enable/disable , "If you have a cron daemon, this feature should start automatically. To disable it, edit the configuration file corresponding with the subvolume you do not want to have this feature and set TIMELINE_CREATE=no"). It is not true on current NixOS.

Options TIMELINE_CREATE and TIMELINE_CLEANUP are set to "no" by default (according to snapper-configs(5)), so just providing configs won't be enough for having automatic backups, which are the main use case for snapper. It is especially important to have it in our docs, as on other linux distributions you would use snapper create-config to generate configs for partitions, and you'd see that TIMELINE_CREATE and TIMELINE_CLEANUP are set to no. Also, my guess is that it might be set to no by default purely for safety reasons in regular distros, so that the config won't be actioned upon until the user finishes customizing it.

Things done

Added TIMELINE_CREATE=yes and TIMELINE_CLEANUP=yes into snapper service config example.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

In the default configuration we have timers for creating and deleting
snapper snapshots, and it looks like if we just create configs with
correct mountpoints we will get automatic snapshots (which either
used to be true, or seems to be only true on Archlinux according to
their wiki). In default snapper configuration TIMELINE_CREATE and
TIMELINE_CLEANUP are set to "no", so just providing configs won't
be enough for having automatic backups, which are the main usecase
for snapper. In other linux distributions you would use `snapper
create-config` to generate configs for partitions and you'd have a
chance to notice that TIMELINE_CREATE is set to no. Also, my guess is
that it might be set to no by default for safety reasons in regular distros,
so that the config won't be actioned upon until the user finishes
customizing it.
Copy link
Member

@markuskowa markuskowa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As as i can see from my own config, these two lines were always required to have regualar snapshots.

@markuskowa markuskowa merged commit 2756a5b into NixOS:master Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants