backup module fix, it now supports multiple folders

This commit is contained in:
boyreau 2026-08-19 11:26:13 +02:00
commit cf8a2f0b74
5 changed files with 145 additions and 122 deletions

View file

@ -0,0 +1,33 @@
{
path,
config,
pkgs,
}:
pkgs.writeShellApplication {
name = "backup-${baseNameOf path}.sh";
runtimeInputs = [
pkgs.gnutar
pkgs.gzip
];
text = ''
#!/bin/bash
# Archive creation and compression
SRC=${path}
DST=$(mktemp --suffix=.tar)
echo "Archiving and compressing $SRC to $DST."
${config.compression.command}
# Archive encryption (optionnal)
SRC=$DST
DST=$(mktemp --suffix=.tar.encrypted)
echo "Encyphering $SRC to $DST."
${config.encryption.command}
# Archive salvation
SRC=$DST
DST="${config.dest}/${baseNameOf path}.tar.enc"
echo "Saving $SRC to $DST."
${config.salvation.command}
'';
}