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

duplicityBackup module: init at v1.3.0 #28850

Closed
wants to merge 2 commits into from

Conversation

betaboon
Copy link
Contributor

@betaboon betaboon commented Sep 1, 2017

Motivation for this change

I wanted to be able to configure encrypted backup using duplicity.
this service is using duplicity-backup.sh to configure and run duplicity

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
    • Linux
  • 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.

};

extraConfig = mkOption {
type = types.str;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider types.lines here, I think it has more intuitive merge semantics for an option like this.

};
script = ''
${cfgPackage}/bin/duplicity-backup.sh \
-c /etc/duplicity-backup.conf \
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of writing to /etc could you pass the config file directly here or is there some other use for storing the config under /etc specifically?

'';
};

onCalendar = mkOption {
Copy link
Contributor

Choose a reason for hiding this comment

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

A potential improvement for the future is to support multiple backup jobs.

then "yes" else "no"
}"
${optionalString cfg.encryption.enable ''
PASSPHRASE="${cfg.encryption.passphrase}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the passphrase will end up in the Nix store. Is that a problem?

}
];

system.activationScripts.duplicity-backup = stringAfter [
Copy link
Contributor

Choose a reason for hiding this comment

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

You can do this in the service's preStart. Then it'll run only when the service is started, not on all nixos system activations (likely to be a waste of time).


stdenv.mkDerivation rec {
name = "duplicity-backup-sh-${version}";
version = "v1.3.0";
Copy link
Member

Choose a reason for hiding this comment

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

The v is not supposed to be in the version part.


buildInputs = [ makeWrapper ];

phases = [ "unpackPhase" "installPhase" ];
Copy link
Member

Choose a reason for hiding this comment

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

Try not to set phases, that should typically only be done by more generic builders. In this case you likely want buildPhase = ":";.

@OlivierMarty
Copy link

This is superseded by #53463.

@betaboon betaboon closed this Mar 4, 2019
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

5 participants