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