diff --git a/modules/homelab/services/glance/default.nix b/modules/homelab/services/glance/default.nix index 197643b..817fde2 100644 --- a/modules/homelab/services/glance/default.nix +++ b/modules/homelab/services/glance/default.nix @@ -228,19 +228,6 @@ in units = "imperial"; hour-format = "24h"; } - { - type = "custom-api"; - title = "uptime"; - title-url = "\${uptimekuma_url}"; - url = "\${uptimekuma_url}/api/status-page/\${uptimekuma_page}"; - subrequests = { - heartbeats = { - url = "\${uptimekuma_url}/api/status-page/heartbeat/\${uptimekuma_page}"; - }; - }; - cache = "10m"; - template = "{{ $hb := .Subrequest \"heartbeats\" }}\n\n{{ if not (.JSON.Exists \"publicGroupList\") }}\n

Error reading response

\n{{ else if eq (len (.JSON.Array \"publicGroupList\")) 0 }}\n

No monitors found

\n{{ else }}\n\n\n{{ end }}\n"; - } { type = "markets"; markets = [ diff --git a/modules/system/backups.nix b/modules/system/backups.nix index 2364bd3..fdccb68 100644 --- a/modules/system/backups.nix +++ b/modules/system/backups.nix @@ -54,29 +54,56 @@ in # EnvironmentFile = config.modules.system.backups.passphraseFile; # the actual script borg is using ExecStart = pkgs.writeShellScript "borg-backup" '' - set -euo pipefail - export BORG_PASSPHRASE="$(cat ${cfg.passwd_file})" - export BORG_REPO="${cfg.repo}" - timestamp="$(date +'%Y-%m-%d_%H:%M:%S')" - mode=${cfg.mode} + backup() { + set -euo pipefail + export BORG_PASSPHRASE="$(cat ${cfg.passwd_file})" + export BORG_REPO="${cfg.repo}" + timestamp="$(date +'%Y-%m-%d_%H:%M:%S')" + mode=${cfg.mode} - # init repo in needed - if ! borg info "$BORG_REPO" >/dev/null 2>&1; then - echo "Initializing Borg repo at $BORG_REPO" - borg init --encryption=repokey "$BORG_REPO" - fi + # init repo in needed + if ! borg info "$BORG_REPO" >/dev/null 2>&1; then + echo "Initializing Borg repo at $BORG_REPO" + borg init --encryption=repokey "$BORG_REPO" + fi - borg break-lock "$BORG_REPO" || true + borg break-lock "$BORG_REPO" || true - echo "starting backup at $timestamp" + echo "starting backup at $timestamp" - if [ "$mode" = "split" ]; then - # loop for each backup - ${lib.concatStringsSep "\n\n" (lib.mapAttrsToList (bak_name: bak_paths: - '' - echo "------------ Backing up ${bak_name} ------------" - archive="$timestamp-${bak_name}" - echo "backing up: ${lib.concatStringsSep " " bak_paths.paths} → $archive" + if [ "$mode" = "split" ]; then + # loop for each backup + ${lib.concatStringsSep "\n\n" (lib.mapAttrsToList (bak_name: bak_paths: + '' + echo "------------ Backing up ${bak_name} ------------" + archive="$timestamp-${bak_name}" + echo "backing up: ${lib.concatStringsSep " " bak_paths.paths} → $archive" + borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --compression lzma,9 \ + "$BORG_REPO::$archive" \ + ${lib.concatStringsSep " " bak_paths.paths} + echo "pruning old backups for ${bak_name}..." + borg prune -v --list "$BORG_REPO" \ + --glob-archives "*-${bak_name}" \ + --keep-daily=7 \ + --keep-weekly=52 \ + --keep-monthly=-1 + echo "backup run complete at \"$BORG_REPO::$archive\"" + '' + ) cfg.baks)} + exit 0 + else + # flatten all paths from cfg.baks into one big list + all_paths="${ + lib.concatStringsSep " " + (lib.flatten + (lib.mapAttrsToList (_: bak: bak.paths) cfg.baks)) + }" borg create \ --verbose \ --filter AME \ @@ -84,44 +111,24 @@ in --stats \ --show-rc \ --compression lzma,9 \ - "$BORG_REPO::$archive" \ - ${lib.concatStringsSep " " bak_paths.paths} - echo "pruning old backups for ${bak_name}..." - borg prune -v --list "$BORG_REPO" \ - --glob-archives "*-${bak_name}" \ - --keep-daily=7 \ - --keep-weekly=52 \ - --keep-monthly=-1 - echo "backup run complete at \"$BORG_REPO::$archive\"" - '' - ) cfg.baks)} - exit 0 - else - # flatten all paths from cfg.baks into one big list - all_paths="${ - lib.concatStringsSep " " - (lib.flatten - (lib.mapAttrsToList (_: bak: bak.paths) cfg.baks)) - }" - borg create \ - --verbose \ - --filter AME \ - --list \ - --stats \ - --show-rc \ - --compression lzma,9 \ - "$BORG_REPO::$timestamp-${toString config.networking.hostName}" \ - $all_paths + "$BORG_REPO::$timestamp-${toString config.networking.hostName}" \ + $all_paths - echo "pruning old backups for ${toString config.networking.hostName}..." - borg prune -v --list "$BORG_REPO" \ - --glob-archives "*-${toString config.networking.hostName}" \ - --keep-daily=7 \ - --keep-weekly=52 \ - --keep-monthly=-1 - echo "backup run complete at \"$BORG_REPO::${toString config.networking.hostName}\"" - exit 0 - fi + echo "pruning old backups for ${toString config.networking.hostName}..." + borg prune -v --list "$BORG_REPO" \ + --glob-archives "*-${toString config.networking.hostName}" \ + --keep-daily=7 \ + --keep-weekly=52 \ + --keep-monthly=-1 + echo "backup run complete at \"$BORG_REPO::${toString config.networking.hostName}\"" + exit 0 + fi + } + time -f "\ + Real time: %E\n\ + User CPU: %U\n\ + Sys CPU: %S\n\ + Max memory: %M KB" backup ''; }; }; diff --git a/users/blake/dotfiles/zsh/.zshrc b/users/blake/dotfiles/zsh/.zshrc index 60dceb3..5d1efdf 100644 --- a/users/blake/dotfiles/zsh/.zshrc +++ b/users/blake/dotfiles/zsh/.zshrc @@ -95,6 +95,8 @@ alias stat='sudo systemctl status' alias restart='sudo systemctl restart' alias start='sudo systemctl start' alias stop='sudo systemctl stop' +alias jou='sudo journalctl -xeu' +alias live='sudo journalctl -o short-iso -n 50 -fu' # shortcuts alias chil='nvim ~/documents/holocron/tech/devices/yveltal/chilton'