tangled
alpha
login
or
join now
aesthetic.computer
/
core
1
fork
atom
Monorepo for Aesthetic.Computer
aesthetic.computer
1
fork
atom
overview
issues
pulls
pipelines
fix: finish nix usb img packaging
prompt.ac/@jeffrey
5 days ago
e412f2b4
74b064d6
+102
-62
7 changed files
expand all
collapse all
unified
split
fedac
native
scripts
media-layout.sh
nixos-image-helper.sh
upload-release.sh
nixos
configuration.nix
flake.lock
oven-edge
worker.mjs
system
public
aesthetic.computer
disks
os.mjs
+33
-2
fedac/native/scripts/media-layout.sh
reviewed
···
273
273
'
274
274
}
275
275
276
276
+
ac_media_partition_number_for_type_guid() {
277
277
+
local image_path="$1"
278
278
+
local type_guid="$2"
279
279
+
280
280
+
python3 - "$image_path" "$type_guid" <<'PYEOF'
281
281
+
import re
282
282
+
import subprocess
283
283
+
import sys
284
284
+
285
285
+
image_path, type_guid = sys.argv[1:]
286
286
+
dump = subprocess.check_output(["sfdisk", "-d", image_path], text=True, stderr=subprocess.DEVNULL)
287
287
+
pattern = re.compile(rf"{re.escape(image_path)}(\d+)\s*:.*type=([0-9A-Fa-f\-]+)")
288
288
+
for line in dump.splitlines():
289
289
+
match = pattern.match(line.strip())
290
290
+
if match and match.group(2).lower() == type_guid.lower():
291
291
+
print(match.group(1))
292
292
+
raise SystemExit(0)
293
293
+
raise SystemExit(1)
294
294
+
PYEOF
295
295
+
}
296
296
+
276
297
ac_media_nixos_data_partition_start_sector() {
277
277
-
ac_media_partition_start_sector "$1" 3
298
298
+
local image_path="$1"
299
299
+
local data_part
300
300
+
301
301
+
data_part="$(ac_media_partition_number_for_type_guid "${image_path}" "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7")" || return 1
302
302
+
ac_media_partition_start_sector "${image_path}" "${data_part}"
278
303
}
279
304
280
305
ac_media_generate_manifest() {
···
348
373
return 1
349
374
fi
350
375
351
351
-
if ! efi_start="$(ac_media_partition_start_sector "${image_path}" 2)"; then
376
376
+
local efi_part
377
377
+
if ! efi_part="$(ac_media_partition_number_for_type_guid "${image_path}" "C12A7328-F81F-11D2-BA4B-00A0C93EC93B")"; then
378
378
+
echo "No EFI boot partition found in ${image_path}" >&2
379
379
+
return 1
380
380
+
fi
381
381
+
382
382
+
if ! efi_start="$(ac_media_partition_start_sector "${image_path}" "${efi_part}")"; then
352
383
echo "No EFI boot partition found in ${image_path}" >&2
353
384
return 1
354
385
fi
+66
-19
fedac/native/scripts/nixos-image-helper.sh
reviewed
···
9
9
log() { echo "[nixos-image-helper] $*"; }
10
10
err() { echo "[nixos-image-helper] $*" >&2; }
11
11
12
12
-
part_path() {
13
13
-
local dev="$1"
14
14
-
local idx="$2"
15
15
-
if [[ "${dev}" =~ [0-9]$ ]]; then
16
16
-
printf '%sp%s\n' "${dev}" "${idx}"
17
17
-
else
18
18
-
printf '%s%s\n' "${dev}" "${idx}"
19
19
-
fi
12
12
+
partition_sector_field() {
13
13
+
local image_path="$1"
14
14
+
local part_number="$2"
15
15
+
local field_name="$3"
16
16
+
python3 - "$image_path" "$part_number" "$field_name" <<'PYEOF'
17
17
+
import re
18
18
+
import subprocess
19
19
+
import sys
20
20
+
21
21
+
image_path, part_number, field_name = sys.argv[1:]
22
22
+
part_number = int(part_number)
23
23
+
dump = subprocess.check_output(["sfdisk", "-d", image_path], text=True, stderr=subprocess.DEVNULL)
24
24
+
pattern = re.compile(rf"{re.escape(image_path)}(\d+)\s*:(.*)")
25
25
+
26
26
+
for line in dump.splitlines():
27
27
+
match = pattern.match(line.strip())
28
28
+
if not match or int(match.group(1)) != part_number:
29
29
+
continue
30
30
+
fields = {}
31
31
+
for field in match.group(2).split(","):
32
32
+
field = field.strip()
33
33
+
if "=" not in field:
34
34
+
continue
35
35
+
key, value = field.split("=", 1)
36
36
+
fields[key.strip()] = value.strip().strip('"')
37
37
+
value = fields.get(field_name)
38
38
+
if value and re.fullmatch(r"\d+", value):
39
39
+
print(value)
40
40
+
raise SystemExit(0)
41
41
+
raise SystemExit(1)
42
42
+
43
43
+
raise SystemExit(1)
44
44
+
PYEOF
20
45
}
21
46
22
47
partition_number_for_type() {
···
85
110
sfdisk --no-reread -N "${part_number}" "${image_path}" >/dev/null
86
111
}
87
112
88
88
-
wait_for_partition() {
113
113
+
wait_for_block_device() {
89
114
local part="$1"
90
115
for _ in $(seq 1 40); do
91
116
[ -b "${part}" ] && return 0
···
95
120
return 1
96
121
}
97
122
98
98
-
LOOP_DEV=""
123
123
+
bind_partition_loop() {
124
124
+
local image_path="$1"
125
125
+
local part_number="$2"
126
126
+
local sector_size=512
127
127
+
local start_sector
128
128
+
local size_sectors
129
129
+
local offset_bytes
130
130
+
local size_bytes
131
131
+
local loop_dev
132
132
+
133
133
+
start_sector="$(partition_sector_field "${image_path}" "${part_number}" "start")"
134
134
+
size_sectors="$(partition_sector_field "${image_path}" "${part_number}" "size")"
135
135
+
offset_bytes=$(( start_sector * sector_size ))
136
136
+
size_bytes=$(( size_sectors * sector_size ))
137
137
+
138
138
+
loop_dev="$(losetup --find --show --offset "${offset_bytes}" --sizelimit "${size_bytes}" "${image_path}")"
139
139
+
LOOP_DEVS+=("${loop_dev}")
140
140
+
printf '%s\n' "${loop_dev}"
141
141
+
}
142
142
+
143
143
+
declare -a LOOP_DEVS=()
99
144
TMP_DIR=""
100
145
EFI_MOUNT=""
101
146
MAC_MOUNT=""
···
105
150
umount "${EFI_MOUNT:-}" 2>/dev/null || true
106
151
umount "${MAC_MOUNT:-}" 2>/dev/null || true
107
152
umount "${DATA_MOUNT:-}" 2>/dev/null || true
108
108
-
if [ -n "${LOOP_DEV}" ]; then
109
109
-
losetup -d "${LOOP_DEV}" 2>/dev/null || true
153
153
+
if [ "${#LOOP_DEVS[@]}" -gt 0 ]; then
154
154
+
local idx
155
155
+
for (( idx=${#LOOP_DEVS[@]}-1; idx>=0; idx-- )); do
156
156
+
losetup -d "${LOOP_DEVS[$idx]}" 2>/dev/null || true
157
157
+
done
110
158
fi
111
159
rm -rf "${TMP_DIR:-}"
112
160
}
···
152
200
"EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" "$(ac_media_nixos_data_label)"
153
201
fi
154
202
155
155
-
LOOP_DEV="$(losetup --find --show --partscan "${IMAGE_PATH}")"
156
156
-
EFI_PART="$(part_path "${LOOP_DEV}" "${EFI_PART_NUM}")"
157
157
-
MAC_PART="$(part_path "${LOOP_DEV}" "${MAC_PART_NUM}")"
158
158
-
DATA_PART="$(part_path "${LOOP_DEV}" "${DATA_PART_NUM}")"
203
203
+
EFI_PART="$(bind_partition_loop "${IMAGE_PATH}" "${EFI_PART_NUM}")"
204
204
+
MAC_PART="$(bind_partition_loop "${IMAGE_PATH}" "${MAC_PART_NUM}")"
205
205
+
DATA_PART="$(bind_partition_loop "${IMAGE_PATH}" "${DATA_PART_NUM}")"
159
206
160
160
-
wait_for_partition "${EFI_PART}"
161
161
-
wait_for_partition "${MAC_PART}"
162
162
-
wait_for_partition "${DATA_PART}"
207
207
+
wait_for_block_device "${EFI_PART}"
208
208
+
wait_for_block_device "${MAC_PART}"
209
209
+
wait_for_block_device "${DATA_PART}"
163
210
164
211
if ! blkid -o value -s LABEL "${MAC_PART}" >/dev/null 2>&1; then
165
212
mkfs.hfsplus -v AC-MAC "${MAC_PART}" >/dev/null
+1
-1
fedac/native/scripts/upload-release.sh
reviewed
···
10
10
11
11
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
12
12
IMAGE_ONLY=0
13
13
-
if [ "${1:-}" = "--image" ] || [ "${1:-}" = "--iso" ]; then
13
13
+
if [ "${1:-}" = "--image" ]; then
14
14
IMAGE_ONLY=1
15
15
IMAGE_PATH="${2:-${SCRIPT_DIR}/../build/ac-os.img}"
16
16
if [ ! -f "$IMAGE_PATH" ]; then
-1
fedac/nixos/configuration.nix
reviewed
···
24
24
"rd.systemd.show_status=1"
25
25
"udev.log_priority=info"
26
26
"consoleblank=0"
27
27
-
"nomodeset"
28
27
];
29
28
boot.consoleLogLevel = 7;
30
29
-37
fedac/nixos/flake.lock
reviewed
···
1
1
{
2
2
"nodes": {
3
3
-
"nixlib": {
4
4
-
"locked": {
5
5
-
"lastModified": 1736643958,
6
6
-
"narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=",
7
7
-
"owner": "nix-community",
8
8
-
"repo": "nixpkgs.lib",
9
9
-
"rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181",
10
10
-
"type": "github"
11
11
-
},
12
12
-
"original": {
13
13
-
"owner": "nix-community",
14
14
-
"repo": "nixpkgs.lib",
15
15
-
"type": "github"
16
16
-
}
17
17
-
},
18
18
-
"nixos-generators": {
19
19
-
"inputs": {
20
20
-
"nixlib": "nixlib",
21
21
-
"nixpkgs": [
22
22
-
"nixpkgs"
23
23
-
]
24
24
-
},
25
25
-
"locked": {
26
26
-
"lastModified": 1769813415,
27
27
-
"narHash": "sha256-nnVmNNKBi1YiBNPhKclNYDORoHkuKipoz7EtVnXO50A=",
28
28
-
"owner": "nix-community",
29
29
-
"repo": "nixos-generators",
30
30
-
"rev": "8946737ff703382fda7623b9fab071d037e897d5",
31
31
-
"type": "github"
32
32
-
},
33
33
-
"original": {
34
34
-
"owner": "nix-community",
35
35
-
"repo": "nixos-generators",
36
36
-
"type": "github"
37
37
-
}
38
38
-
},
39
3
"nixpkgs": {
40
4
"locked": {
41
5
"lastModified": 1774709303,
···
54
18
},
55
19
"root": {
56
20
"inputs": {
57
57
-
"nixos-generators": "nixos-generators",
58
21
"nixpkgs": "nixpkgs"
59
22
}
60
23
}
+1
-1
oven-edge/worker.mjs
reviewed
···
184
184
return applyHeaders(ovenRes, request, { "X-Patch": "origin-fallback" });
185
185
}
186
186
187
187
-
// 3. Get template ISO stream
187
187
+
// 3. Get template image stream
188
188
const template = await getTemplateStream(env, manifest);
189
189
if (!template) {
190
190
// R2 + Spaces both failed — fall through to oven
+1
-1
system/public/aesthetic.computer/disks/os.mjs
reviewed
···
37
37
let bootBtn = null; // "boot to: X" button
38
38
let variantIdx = 0; // index into VARIANTS (0=C, 1=Common Lisp)
39
39
let variantBtn = null; // "build: C" selector
40
40
-
let clAvailable = false; // true once we confirm CL ISO exists on CDN
40
40
+
let clAvailable = false; // true once we confirm the CL image exists on CDN
41
41
let wifiEnabled = true;
42
42
let wifiBtn = null; // "internet: ON/OFF" toggle
43
43
let scrollY = 0;