diff --git a/modules/nixos/my_btrbk/default.nix b/modules/nixos/my_btrbk/default.nix new file mode 100644 index 0000000..82cdec4 --- /dev/null +++ b/modules/nixos/my_btrbk/default.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.my_btrbk; + inherit (lib) mkEnableOption mkIf mkOption; + types = lib.types; +in +{ + options.my_btrbk = { + enable = mkEnableOption "Btrbk backups"; + sshKeyFile = mkOption { + type = types.nonEmptyStr; + }; + sshUser = mkOption { + type = types.nonEmptyStr; + default = "btrbk"; + }; + }; + + config = mkIf cfg.enable { + services.btrbk.instances."remote_falcon" = { + onCalendar = "daily"; + settings = { + ssh_identity = cfg.sshKeyFile; + ssh_user = cfg.sshUser; + + incremental = "yes"; + stream_compress = "zstd"; + stream_compress_level = "3"; + target_preserve_min = "no"; + target_preserve = "5d 4w 6m"; + + subvolume = { + "/" = { + snapshot_name = "root"; + }; + "/home" = { + snapshot_name = "home"; + }; + "/nix" = { + snapshot_name = "nix"; + }; + }; + snapshot_dir = "/.btrbk_snapshots"; + target = "send-receive ssh://10.0.0.5/zpool-backup/backups/${config.networking.hostName}"; + }; + }; + }; +} diff --git a/secrets/btrbk-keyfile.age b/secrets/btrbk-keyfile.age new file mode 100644 index 0000000..079bb9d --- /dev/null +++ b/secrets/btrbk-keyfile.age @@ -0,0 +1,11 @@ +age-encryption.org/v1 +-> ssh-ed25519 Gc/MTQ kKd7HFgJtplJohdcYXwFM+UXZBwBoQ9KJwfQ2jxS2g4 +yrNEIKJYffcf/NG5XnWl1Icic/gUWVsDK1ddqC+QWI0 +-> ssh-ed25519 mOIk4w /3/0Mb4pFu7a/480skeucHFoAddr08h89qqL7Ojt/gA +SaXfyGJFDBTzU+zkDxVLe4SK6UNd9/6g3qtXYOQ/Wwo +-> ssh-ed25519 l9wOAw 8wgspVkjHpxD2tzpVD0yZvipthOVWA6mUWVaWY3Ls20 +iSFw5EEGiv4uYw2JSv8T0fWajLBCajWKQYAHzvjOEwk +--- +3nHDKkQ7xsKKk8wLBe6/Y5aSm8E25+7XlxrfB6V72g +>F㿫s,F)X>~_ ;W0j>g*ԃ!%%`w;RwJ1K͵̨R|sAB`([ +~dXM\lo>FķH F?F(1P_#|2 +Oqpp}jƦrw[D GcegHL^XTfյ *2FoնkWK´V:&E/mDz9=e)ݙLc#BGN.#} ]v^ka}ږYzDܸEl:5)$]G~་&OCN"GJEQj4I0g*6'ЫJ