diff --git a/common.nix b/common.nix index 79814df..f8a72d5 100644 --- a/common.nix +++ b/common.nix @@ -58,7 +58,7 @@ let } ''; - post = "nvd diff $OLD_SYSTEM /run/current-system && (command -v record-update &>/dev/null && record-update $OLD_SYSTEM /run/current-system || true)"; + post = "nvd diff $OLD_SYSTEM /run/current-system"; # The server evaluates and builds for itself. localUpdate = if config.networking.hostName == "FredOS-Mediaserver" @@ -112,7 +112,6 @@ in ./services/bazarr-sync.nix ./services/cloudflare-ddns.nix ./services/authelia.nix - ./services/homepage.nix ./services/arr-interconnect.nix ./services/profilarr.nix ./services/shelfarr.nix diff --git a/hosts/FredOS-Mediaserver.nix b/hosts/FredOS-Mediaserver.nix index c61a546..d118aff 100644 --- a/hosts/FredOS-Mediaserver.nix +++ b/hosts/FredOS-Mediaserver.nix @@ -32,10 +32,6 @@ export PATH="${pkgs.jellyfin-ffmpeg}/bin:${pkgs.coreutils}/bin:${pkgs.findutils}/bin:${pkgs.gnugrep}/bin:${pkgs.gawk}/bin:${pkgs.bc}/bin:${pkgs.curl}/bin:$PATH" exec ${pkgs.bash}/bin/bash ${../scripts/transcode-hevc.sh} "$@" '') - (pkgs.writeShellScriptBin "record-update" '' - export PATH="${pkgs.nvd}/bin:${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${pkgs.gnused}/bin:$PATH" - exec ${pkgs.bash}/bin/bash ${../scripts/record-update.sh} "$@" - '') # Stats stream for the quickshell server monitor on the desktops: # `ssh mediaserver qs-stats` = top's 2s batch stream, interleaved with # one @STAT line per tick (hottest coretemp across both sockets, WAN diff --git a/readme.md b/readme.md index ac1e095..1066b49 100644 --- a/readme.md +++ b/readme.md @@ -45,7 +45,6 @@ Flake-based NixOS configuration for three machines, built and deployed directly │ ├── frigate.nix # NVR with object detection │ ├── game-servers.nix # Dockerised 7 Days to Die servers │ ├── go2rtc.nix # Camera/RTSP streaming -│ ├── homepage.nix # Homepage dashboard with auto-extracted API keys │ ├── jellyfin.nix # Media server │ ├── memos.nix # Flatnotes notes app (container) │ ├── nginx.nix # Reverse proxy + ACME wildcard cert via Cloudflare DNS-01 diff --git a/scripts/deploy-check.py b/scripts/deploy-check.py index 2485742..d97c29c 100644 --- a/scripts/deploy-check.py +++ b/scripts/deploy-check.py @@ -98,20 +98,7 @@ class Fixture(m.Deployment): self.healthy() def deploy(self, ident="a" * 32, flake="fixture", reboot=False): - with patch.object( - Path, - "exists", - autospec=True, - side_effect=lambda p: ( - False - if str(p) == "/run/current-system/sw/bin/record-update" - else original_exists(p) - ), - ): - super().deploy(ident, flake, reboot) - - -original_exists = Path.exists + super().deploy(ident, flake, reboot) class Transactions(unittest.TestCase): diff --git a/scripts/deploy.py b/scripts/deploy.py index a413050..867e904 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -443,17 +443,6 @@ class Deployment: flush=True, ) self.cleanup() - recorder = Path("/run/current-system/sw/bin/record-update") - if recorder.exists(): - try: - self.command( - [str(recorder), record["old_running"], candidate], timeout=30 - ) - except Exception as error: - print( - f"Deployment committed; history recording failed: {error}", - flush=True, - ) if reboot: components = ("kernel", "initrd", "kernel-modules") if any( diff --git a/scripts/record-update.sh b/scripts/record-update.sh deleted file mode 100644 index d2617d2..0000000 --- a/scripts/record-update.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -# Parse `nvd diff ` output and write a JSON summary -# consumed by the Homepage dashboard's customapi widget. -set -euo pipefail - -OLD="${1:-}" -NEW="${2:-/run/current-system}" -OUT_DIR="/var/lib/homepage-updates" -OUT_FILE="$OUT_DIR/latest.json" - -if [ -z "$OLD" ]; then - echo "usage: record-update [new-system]" >&2 - exit 1 -fi - -mkdir -p "$OUT_DIR" - -DIFF=$(nvd diff "$OLD" "$NEW" 2>&1 || true) - -CHANGES=$(printf '%s\n' "$DIFF" | grep -cE '^\[[UAR][.*]\]' || true) -CLOSURE=$(printf '%s\n' "$DIFF" | grep -oE 'disk usage [+-][0-9.]+[A-Za-z]*B?' | head -1 | sed 's/disk usage //') -CLOSURE="${CLOSURE:-+0B}" - -KERNEL=$(uname -r) -DATE=$(date '+%Y-%m-%d %H:%M') - -if [ "$CHANGES" = "0" ]; then - LABEL="No changes" -else - LABEL="$CHANGES package changes" -fi - -cat > "$OUT_FILE.tmp" <... --- - extract_arr_key() { - local name="$1" path="$2" - if [ -f "$path" ]; then - ${pkgs.gnused}/bin/sed -n 's/.*\(.*\)<\/ApiKey>.*/\1/p' "$path" - fi - } - - SONARR_KEY=$(extract_arr_key "sonarr" "/var/lib/sonarr/config.xml") - RADARR_KEY=$(extract_arr_key "radarr" "/var/lib/radarr/config.xml") - PROWLARR_KEY=$(extract_arr_key "prowlarr" "/var/lib/prowlarr/config.xml") - - # --- Bazarr: API key in config.ini under [auth] section --- - BAZARR_KEY="" - if [ -f "/var/lib/bazarr/data/config/config.ini" ]; then - BAZARR_KEY=$(${pkgs.gnugrep}/bin/grep -oP '(?<=apikey = ).*' /var/lib/bazarr/data/config/config.ini || true) - fi - # Fallback: Bazarr sometimes stores it in config.yaml - if [ -z "$BAZARR_KEY" ] && [ -f "/var/lib/bazarr/config/config.yaml" ]; then - BAZARR_KEY=$(${pkgs.gnugrep}/bin/grep -oP '(?<=apikey: ).*' /var/lib/bazarr/config/config.yaml || true) - fi - - # --- Jellyfin: create an API key in the DB if one doesn't exist --- - JELLYFIN_KEY="" - JELLYFIN_DB="/var/lib/jellyfin/data/jellyfin.db" - if [ -f "$JELLYFIN_DB" ]; then - # Check if a "Homepage" key already exists - JELLYFIN_KEY=$(${pkgs.sqlite}/bin/sqlite3 "$JELLYFIN_DB" \ - "SELECT AccessToken FROM ApiKeys WHERE Name = 'Homepage' LIMIT 1;" 2>/dev/null || true) - - if [ -z "$JELLYFIN_KEY" ]; then - # Generate a random 32-char hex token - JELLYFIN_KEY=$(${pkgs.coreutils}/bin/head -c 16 /dev/urandom | ${pkgs.coreutils}/bin/od -An -tx1 | ${pkgs.gnused}/bin/sed 's/ //g' | ${pkgs.coreutils}/bin/head -c 32) - NOW=$(${pkgs.coreutils}/bin/date -u '+%Y-%m-%d %H:%M:%S') - ${pkgs.sqlite}/bin/sqlite3 "$JELLYFIN_DB" \ - "INSERT INTO ApiKeys (DateCreated, DateLastActivity, Name, AccessToken) VALUES ('$NOW', '0001-01-01 00:01:00', 'Homepage', '$JELLYFIN_KEY');" - fi - fi - - # --- Write the secrets file --- - cat > "$SECRETS_FILE" <