From 522b4362b3a4e0087fc4d01799551bbfa455c865 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 27 Mar 2025 18:49:12 +0000 Subject: [PATCH] Add backup-websites script Add a bash script that downloads and backs up my static websites from my server onto my laptop. --- nix/home/opdavies/hosts/t480.nix | 1 + nix/pkgs/backup-websites.nix | 13 +++++++++++++ nix/pkgs/default.nix | 1 + 3 files changed, 15 insertions(+) create mode 100644 nix/pkgs/backup-websites.nix diff --git a/nix/home/opdavies/hosts/t480.nix b/nix/home/opdavies/hosts/t480.nix index 61a19f9c..8b43909d 100644 --- a/nix/home/opdavies/hosts/t480.nix +++ b/nix/home/opdavies/hosts/t480.nix @@ -28,6 +28,7 @@ }; home.packages = with pkgs; [ + backup-websites displayselect isync upload-to-files diff --git a/nix/pkgs/backup-websites.nix b/nix/pkgs/backup-websites.nix new file mode 100644 index 00000000..5ca8cb7f --- /dev/null +++ b/nix/pkgs/backup-websites.nix @@ -0,0 +1,13 @@ +{ lib, pkgs, ... }: + +pkgs.writeShellApplication { + name = "backup-websites"; + + text = '' + backup_path="''${HOME}/server-backup" + + mkdir -p "''${backup_path}" + + ${lib.getExe pkgs.rsync} -avzP ssh.oliverdavies.uk:/var/www/vhosts/ "''${backup_path}" --delete-after + ''; +} diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 5723b5b1..4c5ab423 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -6,6 +6,7 @@ let vimPlugins = callPackage ./vim-plugins { inherit callPackage; }; in { + backup-websites = callPackage ./backup-websites.nix { }; build-glove80 = callPackage ./build-glove80.nix { }; displayselect = callPackage ./displayselect { }; notes = callPackage ./notes { };