forked from aylac.top/nixcfg
this repo has no description

not sure if the config for the disks is perfect but maybe it works. now we have an external disk at nanpi!

Changed files
+84 -2
hosts
modules
snippets
restic
+39
hosts/nanpi/backups.nix
···
···
+
{
+
config,
+
pkgs,
+
...
+
}: let
+
localRepo = "/external1/backups/${config.networking.hostName}";
+
mirrorRepo = "/external1/mirrorBackups";
+
in {
+
services.restic.backups = {
+
pictures =
+
config.mySnippets.restic
+
// {
+
paths = ["/data/DCIM" "/data/Pictures"];
+
repository = "${localRepo}/pictures";
+
};
+
};
+
+
systemd.services.rclone-mirror = {
+
description = "Sync backups from cloud to local mirror";
+
path = with pkgs; [rclone];
+
serviceConfig = {
+
Type = "oneshot";
+
};
+
script = ''
+
set -e
+
rclone --config ${config.age.secrets.rclone.path} sync "a_gdrive:/backups" "${mirrorRepo}"
+
'';
+
};
+
+
systemd.timers.rclone-mirror = {
+
description = "Run rclone mirror sync daily at 3am";
+
wantedBy = ["timers.target"];
+
timerConfig = {
+
OnCalendar = "*-*-* 03:00:00";
+
Persistent = true;
+
RandomizedDelaySec = "10m";
+
};
+
};
+
}
+44 -1
hosts/nanpi/default.nix
···
./home.nix
./secrets.nix
./notifier.nix
self.nixosModules.locale-en-gb
-
self.diskoConfigurations.luks-btrfs-subvolumes
];
networking.hostName = "nanpi";
···
"sd_mod"
"rtsx_pci_sdmmc"
];
};
kernelParams = [
"consoleblank=30"
];
};
}
···
./home.nix
./secrets.nix
./notifier.nix
+
./backups.nix
self.nixosModules.locale-en-gb
];
networking.hostName = "nanpi";
···
"sd_mod"
"rtsx_pci_sdmmc"
];
+
+
luks.devices = {
+
crypted.device = "/dev/disk/by-uuid/d82fc855-f29a-4aef-90d4-da94c23d0ac1";
+
crypted_external.device = "/dev/disk/by-uuid/0e477648-92d6-4cf5-a0c5-8d0707b69935";
+
};
};
kernelParams = [
"consoleblank=30"
];
+
};
+
+
fileSystems = {
+
"/" = {
+
device = "/dev/disk/by-uuid/97fd311a-2575-487e-be03-45dfa9c2db8a";
+
fsType = "btrfs";
+
options = ["subvol=/root" "compress=zstd" "noatime"];
+
};
+
+
"/home" = {
+
device = "/dev/disk/by-uuid/97fd311a-2575-487e-be03-45dfa9c2db8a";
+
fsType = "btrfs";
+
options = ["subvol=/home" "compress=zstd" "noatime"];
+
};
+
+
"/home/.snapshots" = {
+
device = "/dev/disk/by-uuid/97fd311a-2575-487e-be03-45dfa9c2db8a";
+
fsType = "btrfs";
+
options = ["subvol=/home/.snapshots" "compress=zstd" "noatime"];
+
};
+
+
"/nix" = {
+
device = "/dev/disk/by-uuid/97fd311a-2575-487e-be03-45dfa9c2db8a";
+
fsType = "btrfs";
+
options = ["subvol=/nix" "compress=zstd" "noatime"];
+
};
+
+
"/boot" = {
+
device = "/dev/disk/by-uuid/7D56-EE82";
+
fsType = "vfat";
+
options = ["fmask=0077" "dmask=0077"];
+
};
+
+
"/external1" = {
+
device = "/dev/disk/by-uuid/130ead1c-6642-45d5-9053-b6cb2df9c7e4";
+
fsType = "btrfs";
+
options = ["compress=zstd" "noatime"];
+
};
};
}
+1 -1
modules/snippets/restic/default.nix
···
#OnCalendar = "*-*-* 02,14:00:00";
#OnCalendar = "*-*-* 03:14:00";
Persistent = true;
-
RandomizedDelaySec = "10";
};
};
};
···
#OnCalendar = "*-*-* 02,14:00:00";
#OnCalendar = "*-*-* 03:14:00";
Persistent = true;
+
RandomizedDelaySec = "10m";
};
};
};