aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-05-23 03:36:43 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-05-23 03:36:43 +0200
commit46b7e62708f01eaefef78341819643eeceea8130 (patch)
tree16920a3d69d6ce492124724910f8ffd86a8d11df /modules
parentf9914beb086a06e290287f299ae2c2026924a780 (diff)
downloadNix-46b7e62708f01eaefef78341819643eeceea8130.tar.gz
Nix-46b7e62708f01eaefef78341819643eeceea8130.tar.zst
Nix-46b7e62708f01eaefef78341819643eeceea8130.zip
Add check_command for backups
Diffstat (limited to 'modules')
-rw-r--r--modules/private/environment.nix1
-rw-r--r--modules/rsync_backup/default.nix9
2 files changed, 9 insertions, 1 deletions
diff --git a/modules/private/environment.nix b/modules/private/environment.nix
index 5d74ab5..ec9bf29 100644
--- a/modules/private/environment.nix
+++ b/modules/private/environment.nix
@@ -450,6 +450,7 @@ in
450 type = attrsOf (submodule { 450 type = attrsOf (submodule {
451 options = { 451 options = {
452 keep = mkOption { type = int; description = "Number of backups to keep"; }; 452 keep = mkOption { type = int; description = "Number of backups to keep"; };
453 check_command = mkOption { type = str; description = "command to check if backup needs to be done"; default = "backup"; };
453 login = mkOption { type = str; description = "Login to connect to host"; }; 454 login = mkOption { type = str; description = "Login to connect to host"; };
454 port = mkOption { type = str; default = "22"; description = "Port to connect to host"; }; 455 port = mkOption { type = str; default = "22"; description = "Port to connect to host"; };
455 host = mkOption { type = str; description = "Host to connect to"; }; 456 host = mkOption { type = str; description = "Host to connect to"; };
diff --git a/modules/rsync_backup/default.nix b/modules/rsync_backup/default.nix
index 55b32bf..ff84fe3 100644
--- a/modules/rsync_backup/default.nix
+++ b/modules/rsync_backup/default.nix
@@ -41,6 +41,13 @@ let
41 Number of backups to keep 41 Number of backups to keep
42 ''; 42 '';
43 }; 43 };
44 check_command = lib.mkOption {
45 type = lib.types.str;
46 default = "backup";
47 description = ''
48 command to check if backup needs to be done
49 '';
50 };
44 login = lib.mkOption { 51 login = lib.mkOption {
45 type = lib.types.str; 52 type = lib.types.str;
46 description = '' 53 description = ''
@@ -128,7 +135,7 @@ let
128 -o CheckHostIP=no \ 135 -o CheckHostIP=no \
129 -p $PORT \ 136 -p $PORT \
130 -i ${ssh_key} \ 137 -i ${ssh_key} \
131 $DEST backup; then 138 $DEST ${profile.check_command}; then
132 echo "Fichier de verrouillage backup sur $DEST ou impossible de se connecter" >&2 139 echo "Fichier de verrouillage backup sur $DEST ou impossible de se connecter" >&2
133 skip=$DEST 140 skip=$DEST
134 fi 141 fi