consolidate borg programs and add pika-backup's daemon to auto-start instead of the app itself.

This commit is contained in:
Joseph Hanson 2024-07-30 18:02:07 -05:00
parent 1e4e70bfa3
commit b6132b689e
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
6 changed files with 73 additions and 39 deletions

View file

@ -29,7 +29,6 @@ with config;
jetbrains.datagrip jetbrains.datagrip
obsidian obsidian
parsec-bin parsec-bin
pika-backup
talosctl talosctl
termius termius
unstable.nheko unstable.nheko

View file

@ -49,5 +49,6 @@
security._1password.enable = true; security._1password.enable = true;
system.fingerprint-reader-on-laptop-lid.enable = true; system.fingerprint-reader-on-laptop-lid.enable = true;
framework_wifi_swap.enable = true; framework_wifi_swap.enable = true;
system.borg.pika-backup.enable = true;
}; };
} }

View file

@ -0,0 +1,40 @@
{ lib, config, ... }:
let
cfg = config.mySystem.system.borgbackup;
in
{
options.mySystem.system.borgbackup = {
enable = lib.mkEnableOption "borgbackup";
paths = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
exclude = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
repo = lib.mkOption {
example = "borgbackup@myserver:repo";
type = lib.types.str;
default = "";
};
repoKeyPath = lib.mkOption {
example = "/run/secrets/borgbackup/telchar";
type = lib.types.str;
default = "";
};
};
config = lib.mkIf cfg.enable {
services.borgbackup.jobs."borgbackup" = {
inherit (cfg) paths;
inherit (cfg) exclude;
inherit (cfg) repo;
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${cfg.repoKeyPath}";
};
environment.BORG_RSH = "ssh -i /etc/ssh/ssh_host_ed25519_key";
};
};
}

View file

@ -1,40 +1,7 @@
{ lib, config, ... }: { ... }:
let
cfg = config.mySystem.system.borgbackup;
in
{ {
options.mySystem.system.borgbackup = { imports = [
enable = lib.mkEnableOption "borgbackup"; ./borgbackup
paths = lib.mkOption { ./pikabackup
type = lib.types.listOf lib.types.str; ];
default = [ ];
};
exclude = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
repo = lib.mkOption {
example = "borgbackup@myserver:repo";
type = lib.types.str;
default = "";
};
repoKeyPath = lib.mkOption {
example = "/run/secrets/borgbackup/telchar";
type = lib.types.str;
default = "";
};
};
config = lib.mkIf cfg.enable {
services.borgbackup.jobs."borgbackup" = {
inherit (cfg) paths;
inherit (cfg) exclude;
inherit (cfg) repo;
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${cfg.repoKeyPath}";
};
environment.BORG_RSH = "ssh -i /etc/ssh/ssh_host_ed25519_key";
};
};
} }

View file

@ -0,0 +1,4 @@
[Desktop Entry]
Type=Application
Name=org.gnome.World.PikaBackup
Exec=pika-backup-monitor

View file

@ -0,0 +1,23 @@
{ lib, config, pkgs, ... }:
let
cfg = config.mySystem.system.borg.pika-backup;
user = "jahanson";
in
{
options.mySystem.system.borg.pika-backup = {
enable = lib.mkEnableOption "pika-backup";
};
config = lib.mkIf cfg.enable {
# Add package
environment.systemPackages = [
pkgs.pika-backup
];
# Setup auto start at login.
home-manager.users.${user} = {
home.file = {
".config/autostart/pika-backup.desktop".source = ./config/pika-backup.desktop;
};
};
};
}