consolidate borg programs and add pika-backup's daemon to auto-start instead of the app itself.
This commit is contained in:
parent
1e4e70bfa3
commit
b6132b689e
6 changed files with 73 additions and 39 deletions
|
@ -29,7 +29,6 @@ with config;
|
|||
jetbrains.datagrip
|
||||
obsidian
|
||||
parsec-bin
|
||||
pika-backup
|
||||
talosctl
|
||||
termius
|
||||
unstable.nheko
|
||||
|
|
|
@ -49,5 +49,6 @@
|
|||
security._1password.enable = true;
|
||||
system.fingerprint-reader-on-laptop-lid.enable = true;
|
||||
framework_wifi_swap.enable = true;
|
||||
system.borg.pika-backup.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
40
nixos/modules/nixos/system/borg/borgbackup/default.nix
Normal file
40
nixos/modules/nixos/system/borg/borgbackup/default.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,40 +1,7 @@
|
|||
{ 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";
|
||||
};
|
||||
};
|
||||
imports = [
|
||||
./borgbackup
|
||||
./pikabackup
|
||||
];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=org.gnome.World.PikaBackup
|
||||
Exec=pika-backup-monitor
|
23
nixos/modules/nixos/system/borg/pikabackup/default.nix
Normal file
23
nixos/modules/nixos/system/borg/pikabackup/default.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue