IPFS + backup-module configuration to backup stuff daily on the IPFS cluster
This commit is contained in:
parent
60c819fecf
commit
b7096c6ba5
1 changed files with 22 additions and 9 deletions
|
|
@ -4,6 +4,8 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
pkgs = import /etc/nixos/pkgs/jailed-packages.nix;
|
pkgs = import /etc/nixos/pkgs/jailed-packages.nix;
|
||||||
|
npins = import /etc/nixos/npins/default.nix;
|
||||||
|
pkgs-unstable = import npins.nixpkgs-unstable { }; # TODO remove once kubo-0.43 is stable
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
|
@ -52,17 +54,28 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.backup = {
|
services.backup =
|
||||||
"/home/zo/dev" = {
|
let
|
||||||
enable = true;
|
ipfs = "env IPFS_PATH=/var/lib/ipfs ${pkgs.lib.getExe' pkgs-unstable.kubo "ipfs"}";
|
||||||
dest = "/tmp/backups/";
|
ipfs-cluster-ctl = "env IPFS_CLUSTER_PATH=/var/lib/ipfs-cluster ${pkgs.lib.getExe' pkgs.ipfs-cluster "ipfs-cluster-ctl"}";
|
||||||
};
|
in
|
||||||
|
{
|
||||||
|
"/home/zo/dev" = {
|
||||||
|
enable = true;
|
||||||
|
dest = "/tmp/backups/";
|
||||||
|
};
|
||||||
|
|
||||||
"/home/zo/Documents" = {
|
"/home/zo/Documents" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
dest = "/tmp/backups/";
|
dest = "/tmp/backups/";
|
||||||
|
salvation.command = /* bash */ ''
|
||||||
|
SAVED_FILE="$(basename "$SRC")"
|
||||||
|
mv "$SRC" "/mfs/$SAVED_FILE";
|
||||||
|
HASH="$(${ipfs} files stat --hash "/$SAVED_FILE")"
|
||||||
|
${ipfs-cluster-ctl} pin add "$HASH";
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
steam.enable = true;
|
steam.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue