expose the path to the backup passphrase as an option
This commit is contained in:
parent
c0202bbdef
commit
fa2ff2bd39
4 changed files with 29 additions and 15 deletions
|
@ -46,9 +46,8 @@ in
|
||||||
vpnExtension = "3";
|
vpnExtension = "3";
|
||||||
};
|
};
|
||||||
backupClient = {
|
backupClient = {
|
||||||
enable = true;
|
bs.enable = true;
|
||||||
bs = true;
|
gs.enable = false;
|
||||||
gs = false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,30 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
dadada.backupClient = {
|
dadada.backupClient = {
|
||||||
enable = mkEnableOption "Enable backup client";
|
gs = {
|
||||||
gs = mkEnableOption "Enable backup to GS location";
|
enable = mkEnableOption "Enable backup to GS location";
|
||||||
bs = mkEnableOption "Enable backup to BS location";
|
passphrasePath = mkOption {
|
||||||
|
type = with types; nullOr str;
|
||||||
|
description = ''
|
||||||
|
The path to the passphrase file.
|
||||||
|
'';
|
||||||
|
default = "/var/lib/borgbackup/gs/passphrase";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
bs = {
|
||||||
|
enable = mkEnableOption "Enable backup to BS location";
|
||||||
|
passphrasePath = mkOption {
|
||||||
|
type = with types; nullOr str;
|
||||||
|
description = ''
|
||||||
|
The path to the passphrase file.
|
||||||
|
'';
|
||||||
|
default = "/var/lib/borgbackup/bs/passphrase";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.gs.enable {
|
||||||
|
|
||||||
fileSystems = mkIf cfg.gs {
|
fileSystems = mkIf cfg.gs {
|
||||||
"/backup" = {
|
"/backup" = {
|
||||||
device = "/dev/disk/by-uuid/0fdab735-cc3e-493a-b4ec-cbf6a77d48d5";
|
device = "/dev/disk/by-uuid/0fdab735-cc3e-493a-b4ec-cbf6a77d48d5";
|
||||||
|
@ -47,7 +63,7 @@ in
|
||||||
doInit = false;
|
doInit = false;
|
||||||
encryption = {
|
encryption = {
|
||||||
mode = "repokey";
|
mode = "repokey";
|
||||||
passCommand = "cat /var/lib/borgbackup/gs/passphrase";
|
passCommand = "cat ${cfg.gs.passphrasePath}";
|
||||||
};
|
};
|
||||||
compression = "auto,lz4";
|
compression = "auto,lz4";
|
||||||
prune.keep = {
|
prune.keep = {
|
||||||
|
@ -58,7 +74,7 @@ in
|
||||||
yearly = -1; # Keep at least one archive for each year
|
yearly = -1; # Keep at least one archive for each year
|
||||||
};
|
};
|
||||||
startAt = "monthly";
|
startAt = "monthly";
|
||||||
};
|
} // mkIf cfg.bs.enable {
|
||||||
|
|
||||||
services.borgbackup.jobs.bs = mkIf cfg.bs {
|
services.borgbackup.jobs.bs = mkIf cfg.bs {
|
||||||
paths = "/";
|
paths = "/";
|
||||||
|
@ -70,7 +86,7 @@ in
|
||||||
};
|
};
|
||||||
encryption = {
|
encryption = {
|
||||||
mode = "repokey";
|
mode = "repokey";
|
||||||
passCommand = "cat /var/lib/borgbackup/bs/passphrase";
|
passCommand = "cat ${cfg.bs.passphrasePath}";
|
||||||
};
|
};
|
||||||
compression = "auto,lz4";
|
compression = "auto,lz4";
|
||||||
startAt = "daily";
|
startAt = "daily";
|
||||||
|
@ -79,4 +95,5 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,7 @@ in {
|
||||||
dadada.admin.enable = true;
|
dadada.admin.enable = true;
|
||||||
|
|
||||||
dadada.backupClient = {
|
dadada.backupClient = {
|
||||||
enable = true;
|
bs.enable = true;
|
||||||
bs = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
|
|
|
@ -49,8 +49,7 @@ in
|
||||||
dadada.homePage.enable = true;
|
dadada.homePage.enable = true;
|
||||||
dadada.share.enable = true;
|
dadada.share.enable = true;
|
||||||
dadada.backupClient = {
|
dadada.backupClient = {
|
||||||
enable = true;
|
bs.enable = true;
|
||||||
bs = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue