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

znapzend service: stateless setup #32914

Merged
merged 1 commit into from Dec 31, 2017
Merged

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Dec 20, 2017

This enables znapzend users to specify its full configuration through
NixOS options, without ever needing to use the stateful znapzendzetup
command.

This works by running znapzendzetup with the specified config in
ExecPre, just before the znapzend daemon is started.

There is also the pure option which will clear all previous znapzend setups,
making it as stateless as can get, as only the setup declared in
configuration.nix will be persisted.

Here is the configuration I'm using for one of my machines:

{
  services.znapzend = {
    enable = true;
    autoCreation = true;
    pure = true;
    zetup."main/data" = rec {
      plan = "15min=>5min,1h=>15min,1d=>1h,1w=>1d,1m=>1w";
      recursive = true;
      destinations.backup = {
        dataset = "betty/backup";
        plan = plan + ",1y=>1m";
        presend = "zpool import -f betty | true";
      };
    };
  };
}
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@orivej
Copy link
Contributor

orivej commented Dec 24, 2017

(Although the commit should begin with nixos/znapzend: according to the manual.)

This enables znapzend users to specify its full configuration through
NixOS options, without ever needing to use the stateful `znapzendzetup`
command.

This works by running znapzendzetup with the specified config in
ExecPre, just before the znapzend daemon is started.

There is also the `pure` option which will clear all previous znapzend setups,
making it as stateless as can get, as only the setup declared in
configuration.nix will be persisted.
@infinisil
Copy link
Member Author

I updated the commit message and changed one minor thing: The enable option now includes the string "ZFS" which makes it so Znapzend is included when searching for "ZFS".

@orivej orivej merged commit 54d01b0 into NixOS:master Dec 31, 2017
@infinisil infinisil deleted the znapzendzetup branch July 5, 2018 23:42
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

3 participants