diff --git a/nixos/home/jahanson/workstation.nix b/nixos/home/jahanson/workstation.nix index b15d537..db1eee1 100644 --- a/nixos/home/jahanson/workstation.nix +++ b/nixos/home/jahanson/workstation.nix @@ -29,7 +29,6 @@ with config; jetbrains.datagrip obsidian parsec-bin - pika-backup talosctl termius unstable.nheko diff --git a/nixos/hosts/telchar/default.nix b/nixos/hosts/telchar/default.nix index a21885f..88943d6 100644 --- a/nixos/hosts/telchar/default.nix +++ b/nixos/hosts/telchar/default.nix @@ -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; }; } diff --git a/nixos/modules/nixos/system/borg/borgbackup/default.nix b/nixos/modules/nixos/system/borg/borgbackup/default.nix new file mode 100644 index 0000000..20be51b --- /dev/null +++ b/nixos/modules/nixos/system/borg/borgbackup/default.nix @@ -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"; + }; + }; +} diff --git a/nixos/modules/nixos/system/borg/default.nix b/nixos/modules/nixos/system/borg/default.nix index 20be51b..2fbaedf 100644 --- a/nixos/modules/nixos/system/borg/default.nix +++ b/nixos/modules/nixos/system/borg/default.nix @@ -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 + ]; } diff --git a/nixos/modules/nixos/system/borg/pikabackup/config/pika-backup.desktop b/nixos/modules/nixos/system/borg/pikabackup/config/pika-backup.desktop new file mode 100644 index 0000000..e6884fa --- /dev/null +++ b/nixos/modules/nixos/system/borg/pikabackup/config/pika-backup.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=org.gnome.World.PikaBackup +Exec=pika-backup-monitor \ No newline at end of file diff --git a/nixos/modules/nixos/system/borg/pikabackup/default.nix b/nixos/modules/nixos/system/borg/pikabackup/default.nix new file mode 100644 index 0000000..f5745be --- /dev/null +++ b/nixos/modules/nixos/system/borg/pikabackup/default.nix @@ -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; + }; + }; + }; +}