summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/backup.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-02-07 05:32:03 +0100
committertv <tv@krebsco.de>2016-02-07 06:24:04 +0100
commit02ad327081f2315b9ab15733319b167f64180a0d (patch)
tree3e1dbf7a084223c8ee3f5a985cdc7b826df6ce67 /krebs/3modules/backup.nix
parent949f466cf78ba2e76002012715172e5d5d394006 (diff)
krebs.backup writeDash* -> pkgs
Diffstat (limited to 'krebs/3modules/backup.nix')
-rw-r--r--krebs/3modules/backup.nix35
1 files changed, 10 insertions, 25 deletions
diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix
index 0f85b4879..ae766fa9d 100644
--- a/krebs/3modules/backup.nix
+++ b/krebs/3modules/backup.nix
@@ -128,11 +128,11 @@ let
};
push = plan: let
- # We use writeDashBin and return the absolute path so systemd will produce
- # nice names in the log, i.e. without the Nix store hash.
+ # We use pkgs.writeDashBin and return the absolute path so systemd will
+ # produce nice names in the log, i.e. without the Nix store hash.
out = "${main}/bin/${main.name}";
- main = writeDashBin "backup.${plan.name}.push" ''
+ main = pkgs.writeDashBin "backup.${plan.name}.push" ''
set -efu
dst=${shell.escape plan.dst.path}
@@ -140,7 +140,7 @@ let
exec flock -n "$dst" ${critical-section}
'';
- critical-section = writeDash "backup.${plan.name}.push.critical-section" ''
+ critical-section = pkgs.writeDash "backup.${plan.name}.push.critical-section" ''
# TODO check if there is a previous
set -efu
identity=${shell.escape plan.src.host.ssh.privkey.path}
@@ -173,7 +173,7 @@ let
env NOW="$NOW" /bin/sh < ${remote-snapshot}
'';
- remote-snapshot = writeDash "backup.${plan.name}.push.remote-snapshot" ''
+ remote-snapshot = pkgs.writeDash "backup.${plan.name}.push.remote-snapshot" ''
set -efu
dst=${shell.escape plan.dst.path}
@@ -191,11 +191,11 @@ let
# TODO admit plan.dst.user and its ssh identity
pull = plan: let
- # We use writeDashBin and return the absolute path so systemd will produce
- # nice names in the log, i.e. without the Nix store hash.
+ # We use pkgs.writeDashBin and return the absolute path so systemd will
+ # produce nice names in the log, i.e. without the Nix store hash.
out = "${main}/bin/${main.name}";
- main = writeDashBin "backup.${plan.name}.pull" ''
+ main = pkgs.writeDashBin "backup.${plan.name}.pull" ''
set -efu
dst=${shell.escape plan.dst.path}
@@ -203,7 +203,7 @@ let
exec flock -n "$dst" ${critical-section}
'';
- critical-section = writeDash "backup.${plan.name}.pull.critical-section" ''
+ critical-section = pkgs.writeDash "backup.${plan.name}.pull.critical-section" ''
# TODO check if there is a previous
set -efu
identity=${shell.escape plan.dst.host.ssh.privkey.path}
@@ -235,7 +235,7 @@ let
'';
in out;
- take-snapshots = plan: writeDash "backup.${plan.name}.take-snapshots" ''
+ take-snapshots = plan: pkgs.writeDash "backup.${plan.name}.take-snapshots" ''
set -efu
NOW=''${NOW-$(date +%s)}
dst=${shell.escape plan.dst.path}
@@ -280,21 +280,6 @@ let
plan.snapshots)}
'';
- writeDash = name: text: pkgs.writeScript name ''
- #! ${pkgs.dash}/bin/dash
- ${text}
- '';
-
- writeDashBin = name: text: pkgs.writeTextFile {
- executable = true;
- destination = "/bin/${name}";
- name = name;
- text = ''
- #! ${pkgs.dash}/bin/dash
- ${text}
- '';
- };
-
# XXX Is one ping enough to determine fastest address?
# Note that we're using net.addrs4 instead of net.aliases because we define
# ports only for addresses. See krebs/3modules/default.nix