This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.worldview: remove

-162
-118
tools/worldview/flake-module.nix
··· 1 - { ... }: 2 - { 3 - perSystem = 4 - { pkgs, ... }: 5 - let 6 - version = "0-unstable-2026-05-03"; 7 - rev = "f325daad229bb15f6a1d1d3d1e9f76a744d2b2c4"; 8 - src = pkgs.fetchFromGitHub { 9 - owner = "audibleblink"; 10 - repo = "worldview"; 11 - inherit rev; 12 - hash = "sha256-L18lWcK5gEEiLyYSETk3+7KacBjxpr4SwrolcWXu4sc="; 13 - }; 14 - in 15 - { 16 - packages.worldview = pkgs.writeShellApplication { 17 - name = "worldview"; 18 - passthru = { 19 - inherit version; 20 - updateScript = ./update.sh; 21 - }; 22 - runtimeInputs = [ 23 - pkgs.bun 24 - pkgs.ungoogled-chromium 25 - pkgs.python3 26 - pkgs.curl 27 - pkgs.gnused 28 - ]; 29 - text = '' 30 - # Required env vars 31 - if [ -z "''${GOOGLE_MAPS_TILE_API_KEY:-}" ]; then 32 - echo "ERROR: GOOGLE_MAPS_TILE_API_KEY is not set" >&2 33 - echo "Get one at: https://console.cloud.google.com/google/maps-apis/credentials" >&2 34 - echo "Export it: export GOOGLE_MAPS_TILE_API_KEY=your_key_here" >&2 35 - exit 1 36 - fi 37 - 38 - get_free_port() { 39 - python3 -c 'import socket; s=socket.socket(); s.bind(("",0)); print(s.getsockname()[1]); s.close()' 40 - } 41 - 42 - FRONTEND_PORT=$(get_free_port) 43 - BACKEND_PORT=$(get_free_port) 44 - 45 - WORKDIR="''${XDG_DATA_HOME:-$HOME/.local/share}/worldview" 46 - mkdir -p "$WORKDIR" 47 - 48 - # Copy source if not yet present or if version changed 49 - MARKER="$WORKDIR/.version" 50 - CURRENT_REV="${rev}" 51 - if [ ! -f "$MARKER" ] || [ "$(cat "$MARKER")" != "$CURRENT_REV" ]; then 52 - echo "Setting up worldview source..." 53 - rm -rf "$WORKDIR/src" 54 - cp -r ${src} "$WORKDIR/src" 55 - chmod -R u+w "$WORKDIR/src" 56 - echo "$CURRENT_REV" > "$MARKER" 57 - rm -f "$WORKDIR/.installed" 58 - fi 59 - 60 - cd "$WORKDIR/src" 61 - 62 - # Install dependencies if needed 63 - if [ ! -f "$WORKDIR/.installed" ]; then 64 - echo "Installing dependencies..." 65 - bun install 66 - touch "$WORKDIR/.installed" 67 - fi 68 - 69 - # Patch hardcoded ports in source 70 - sed -i 's|const PORT = [0-9]*;|const PORT = '"$FRONTEND_PORT"';|' src/server.ts 71 - sed -i 's|http://localhost:[0-9]*"|http://localhost:'"$BACKEND_PORT"'"|g' src/config.ts 72 - 73 - cleanup() { 74 - echo "Shutting down..." 75 - # Kill entire process group to catch bun child processes 76 - kill -- -$$ 2>/dev/null || true 77 - } 78 - trap cleanup EXIT INT TERM 79 - 80 - export GOOGLE_MAPS_TILE_API_KEY 81 - export SERVER_PORT="$BACKEND_PORT" 82 - ''${AISSTREAM_API_KEY:+export AISSTREAM_API_KEY} 83 - 84 - # Start backend server 85 - bun run --hot src/server/index.ts & 86 - 87 - # Start frontend dev server 88 - bun run --hot src/server.ts & 89 - 90 - # Wait for frontend to be ready 91 - for _ in $(seq 1 30); do 92 - if curl -s "http://localhost:$FRONTEND_PORT" > /dev/null 2>&1; then 93 - break 94 - fi 95 - sleep 1 96 - done 97 - 98 - echo "WorldView is running at http://localhost:$FRONTEND_PORT" 99 - 100 - # Open in chromium app mode with a dedicated profile 101 - CHROME_DIR="$WORKDIR/chromium-profile" 102 - # Remove stale singleton locks from crashed sessions 103 - rm -f "$CHROME_DIR/SingletonLock" "$CHROME_DIR/SingletonCookie" "$CHROME_DIR/SingletonSocket" 104 - mkdir -p "$CHROME_DIR" 105 - chromium \ 106 - --user-data-dir="$CHROME_DIR" \ 107 - --no-first-run \ 108 - --no-default-browser-check \ 109 - --disable-gpu-compositing \ 110 - --app="http://localhost:$FRONTEND_PORT" & 111 - CHROME_PID=$! 112 - 113 - # Wait for chromium to exit (closing the window kills the process) 114 - wait "$CHROME_PID" 2>/dev/null || true 115 - ''; 116 - }; 117 - }; 118 - }
-44
tools/worldview/update.sh
··· 1 - #!/usr/bin/env bash 2 - set -euo pipefail 3 - 4 - # Tracks the default branch (dev) of audibleblink/worldview. 5 - # nix-update can't edit this flake-module.nix (no package.nix / meta.position). 6 - owner=audibleblink 7 - repo=worldview 8 - attr=worldview 9 - 10 - # Run by update-pkgs from the flake root ($0 is a read-only store copy). 11 - file=tools/worldview/flake-module.nix 12 - # Depends on ungoogled-chromium, which only evaluates on Linux. 13 - system=x86_64-linux 14 - 15 - commit=$(curl -fsSL "https://api.github.com/repos/$owner/$repo/commits/HEAD") 16 - new_rev=$(jq -r .sha <<<"$commit") 17 - new_date=$(jq -r .commit.committer.date <<<"$commit" | cut -d T -f1) 18 - new_version="0-unstable-$new_date" 19 - old_rev=$(sed -n 's/^ *rev = "\([0-9a-f]*\)";/\1/p' "$file") 20 - if [ "$old_rev" = "$new_rev" ]; then 21 - echo "$attr: already up to date ($new_rev)" 22 - exit 0 23 - fi 24 - 25 - # Blank the hash: with the old one nix reuses the cached FOD (old source). 26 - sed -i \ 27 - -e "s|^\( *\)rev = \"[0-9a-f]*\";|\1rev = \"$new_rev\";|" \ 28 - -e "s|^\( *\)version = \"[^\"]*\";|\1version = \"$new_version\";|" \ 29 - -e "s|^\( *\)hash = \"[^\"]*\";|\1hash = \"\";|" \ 30 - "$file" 31 - 32 - build_attr=".#packages.$system.$attr" 33 - 34 - # Probe build is expected to fail with a hash mismatch. 35 - got=$({ nix build --no-link "$build_attr" 2>&1 || true; } | tee /dev/stderr \ 36 - | awk '/got:/ && !seen { print $2; seen = 1 }' || true) 37 - if [ -z "$got" ]; then 38 - echo "$attr: failed to determine src hash" >&2 39 - exit 1 40 - fi 41 - sed -i "s|^\( *\)hash = \"\";|\1hash = \"$got\";|" "$file" 42 - 43 - echo "$attr: updated $old_rev -> $new_rev ($new_version)" 44 - nix build --no-link "$build_attr"