override borgbackup service in module

This commit is contained in:
cy 2024-12-30 23:14:25 -05:00
parent b5f231ac01
commit d428cd2377
2 changed files with 22 additions and 8 deletions

View file

@ -1,4 +1,11 @@
{ config, lib, pkgs, ... }: let {
config,
lib,
pkgs,
inputs,
...
}:
let
cfg = config.my.backup; cfg = config.my.backup;
hostname = config.networking.hostName; hostname = config.networking.hostName;
defaultPaths = [ defaultPaths = [
@ -22,17 +29,25 @@
"**/.docker" "**/.docker"
"**/borg" "**/borg"
]; ];
in { in
{
imports = [
{
disabledModules = [ "services/backup/borgbackup.nix" ];
}
(inputs.nixpkgs-borg + "/nixos/modules/services/backup/borgbackup.nix")
];
options.my.backup = { options.my.backup = {
enable = lib.mkEnableOption "backup"; enable = lib.mkEnableOption "backup";
paths = lib.mkOption { paths = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = []; default = [ ];
description = "Paths to backup. Appended to the list of defaultPaths"; description = "Paths to backup. Appended to the list of defaultPaths";
}; };
exclude = lib.mkOption { exclude = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = []; default = [ ];
description = "Paths to exclude. Appended to the list of defaultExclude"; description = "Paths to exclude. Appended to the list of defaultExclude";
}; };
repo = lib.mkOption { repo = lib.mkOption {
@ -94,9 +109,7 @@ in {
title="${hostname}: backup completed with exit code: $exitStatus" title="${hostname}: backup completed with exit code: $exitStatus"
msg=$(journalctl -o cat _SYSTEMD_INVOCATION_ID=$invocationId) msg=$(journalctl -o cat _SYSTEMD_INVOCATION_ID=$invocationId)
${pkgs.curl}/bin/curl -sL -u $(cat ${ ${pkgs.curl}/bin/curl -sL -u $(cat ${config.sops.secrets."services/ntfy".path}) \
config.sops.secrets."services/ntfy".path
}) \
-H "Title: $title" \ -H "Title: $title" \
-d "$msg" \ -d "$msg" \
https://ntfy.cything.io/backups > /dev/null https://ntfy.cything.io/backups > /dev/null

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
imports = [ imports = [
./backup.nix ./backup.nix
]; ];