mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 16:57:55 +00:00
6b481a163a
While it is easier to maintain the modules by prefixing them all with `modules`, it is not easy when used from other flakes and/or modules. This is my attempt on making it easier with appropriate namespaces. Update home-manager user from the restructure
44 lines
1.2 KiB
Nix
44 lines
1.2 KiB
Nix
# This is my external hard drive.
|
|
{ config, options, lib, pkgs, ... }:
|
|
|
|
# TODO: Make this a generic service.
|
|
# There are multiple external storage drives now.
|
|
let cfg = config.hardware-setup.backup-archive;
|
|
in {
|
|
options.hardware-setup.backup-archive.enable = lib.mkEnableOption
|
|
"external hard drive and automated backup service with BorgBackup";
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
assertions = [{
|
|
assertion = config.profiles.agenix.enable;
|
|
message = "Agenix module is not enabled.";
|
|
}];
|
|
|
|
age.secrets.external-backup-borgmatic-settings.file =
|
|
lib.getSecret "archive/borgmatic.json";
|
|
|
|
fileSystems."/mnt/external-storage" = {
|
|
device = "/dev/disk/by-uuid/665A391C5A38EB07";
|
|
fsType = "ntfs";
|
|
noCheck = true;
|
|
options = [
|
|
"nofail"
|
|
"noauto"
|
|
"user"
|
|
|
|
# See systemd.mount.5 and systemd.automount.5 manual page for more
|
|
# details.
|
|
"x-systemd.automount"
|
|
"x-systemd.device-timeout=2"
|
|
"x-systemd.idle-timeout=2"
|
|
];
|
|
};
|
|
|
|
# This uses the custom borgmatic NixOS service.
|
|
services.borgmatic.jobs.external-storage = {
|
|
startAt = "04/6:00:00";
|
|
configPath = config.age.secrets.external-backup-borgmatic-settings.path;
|
|
};
|
|
};
|
|
}
|