Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

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

fix: nix usb boot improvements — silent boot, cursor, shutdown, mic

Continuing from 2acb823e7 which enabled wifi/sound/kidlisp on nix:

NixOS boot:
- Switch GRUB → systemd-boot (cut loader from 2min to ~55s)
- EFI-only partition table (no BIOS boot, fixes ThinkPad 11e)
- Silent boot: console=tty2, quiet, initrd.verbose=false
- Filter build/ dir from nix source (device nodes crash nix eval)

ac-native (C):
- Hide Wayland cursor via wl_pointer_set_cursor(NULL) on enter
- Use systemctl poweroff/reboot when not PID 1 (fixes "failed to
execute shutdown binary" under systemd)
- Aggressive mic compressor: threshold 0.15 (was 0.5), ratio 12:1
(was 4:1), hard limiter at 0.9 to prevent clipping

Kiosk service:
- Add ALSA_CONFIG_PATH for NixOS alsa-lib store path
- WLR_NO_HARDWARE_CURSORS + XCURSOR_SIZE=1 env vars
- Quieter kernel params in base configuration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+74 -40
+31 -14
fedac/native/src/ac-native.c
··· 148 148 poweroff_requested = 1; 149 149 } 150 150 151 + // Shutdown/reboot that works both as PID 1 (bare metal) and under systemd (NixOS). 152 + static void ac_poweroff(void) { 153 + sync(); 154 + usleep(500000); 155 + sync(); 156 + if (getpid() == 1) { 157 + reboot(LINUX_REBOOT_CMD_POWER_OFF); 158 + } else { 159 + system("systemctl poweroff"); 160 + _exit(0); 161 + } 162 + } 163 + 164 + static void ac_reboot(void) { 165 + sync(); 166 + usleep(500000); 167 + sync(); 168 + if (getpid() == 1) { 169 + reboot(LINUX_REBOOT_CMD_RESTART); 170 + } else { 171 + system("systemctl reboot"); 172 + _exit(2); 173 + } 174 + } 175 + 151 176 static void signal_handler(int sig) { 152 177 running = 0; 153 178 ··· 2091 2116 // Write diagnostics to USB too 2092 2117 system("cat /proc/cmdline >> /mnt/ac-init.log 2>/dev/null"); 2093 2118 system("dmesg 2>/dev/null | grep -i 'drm\\|i915\\|display' >> /mnt/ac-init.log 2>/dev/null"); 2094 - if (getpid() == 1) { sleep(30); reboot(LINUX_REBOOT_CMD_POWER_OFF); } 2119 + sleep(30); ac_poweroff(); 2095 2120 return 1; 2096 2121 } 2097 2122 ··· 2252 2277 audio_shutdown_sound(audio); 2253 2278 usleep(500000); 2254 2279 sync(); 2255 - // sysrq reboot (reliable under initramfs) 2256 - FILE *sr = fopen("/proc/sysrq-trigger", "w"); 2257 - if (sr) { fputs("b", sr); fclose(sr); } 2258 - reboot(LINUX_REBOOT_CMD_RESTART); 2280 + ac_reboot(); 2259 2281 while (running) sleep(1); 2260 2282 } 2261 2283 } ··· 2395 2417 if (display) drm_destroy(display); 2396 2418 if (logfile) { fclose(logfile); logfile = NULL; } 2397 2419 sync(); 2398 - if (getpid() == 1) reboot(LINUX_REBOOT_CMD_POWER_OFF); 2420 + ac_poweroff(); 2399 2421 return 1; 2400 2422 } 2401 2423 ··· 2603 2625 if (reboot_requested) { 2604 2626 ac_log("[cage-transition] Reboot requested by cage child\n"); 2605 2627 ac_log_flush(); 2606 - sync(); usleep(500000); sync(); 2607 - reboot(LINUX_REBOOT_CMD_RESTART); 2628 + ac_reboot(); 2608 2629 } 2609 2630 if (poweroff_requested) { 2610 2631 ac_log("[cage-transition] Poweroff requested by cage child\n"); 2611 2632 ac_log_flush(); 2612 - sync(); usleep(500000); sync(); 2613 - reboot(LINUX_REBOOT_CMD_POWER_OFF); 2633 + ac_poweroff(); 2614 2634 } 2615 2635 2616 2636 // Reclaim DRM and continue in DRM mode (fallback) ··· 3494 3514 fb_destroy(screen); 3495 3515 if (display) drm_destroy(display); 3496 3516 3497 - if (getpid() == 1) { 3498 - sync(); 3499 - reboot(LINUX_REBOOT_CMD_POWER_OFF); 3500 - } 3517 + ac_poweroff(); 3501 3518 3502 3519 return 0; 3503 3520 }
+13 -7
fedac/native/src/audio.c
··· 1211 1211 } 1212 1212 1213 1213 float peak = 0.0f; 1214 - // Simple compressor: track envelope, apply gain reduction 1214 + // Aggressive compressor + hard limiter to prevent clipping. 1215 + // Matches the note compression style in the synth output. 1215 1216 static float env = 0.0f; // envelope follower 1216 1217 static float comp_gain = 1.0f; // current gain 1217 - const float threshold = 0.5f; // compress above this 1218 - const float ratio = 4.0f; // 4:1 compression 1219 - const float attack = 0.002f; // fast attack 1220 - const float release = 0.0001f; // slow release 1218 + const float threshold = 0.15f; // compress early (mic input is often hot) 1219 + const float ratio = 12.0f; // aggressive compression 1220 + const float attack = 0.005f; // fast attack 1221 + const float release = 0.00005f; // slow release (smooth) 1222 + const float limiter = 0.9f; // hard limiter ceiling 1221 1223 1222 1224 for (int s = 0; s < n; s++) { 1223 1225 float sample; ··· 1240 1242 float reduced = threshold + over / ratio; 1241 1243 comp_gain = reduced / env; 1242 1244 } else { 1243 - // Slowly return to unity 1244 - comp_gain += 0.0001f * (1.0f - comp_gain); 1245 + comp_gain += 0.0002f * (1.0f - comp_gain); 1245 1246 } 1246 1247 1247 1248 sample *= comp_gain; 1249 + 1250 + // Hard limiter — prevent any clipping 1251 + if (sample > limiter) sample = limiter; 1252 + else if (sample < -limiter) sample = -limiter; 1253 + 1248 1254 if (abs_s > peak) peak = abs_s; 1249 1255 1250 1256 // Always write to ring buffer
+3 -1
fedac/native/src/input.c
··· 906 906 // Wayland pointer listener 907 907 static void wl_pointer_enter(void *data, struct wl_pointer *ptr, uint32_t serial, 908 908 struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) { 909 - (void)ptr; (void)serial; (void)surface; 909 + (void)surface; 910 910 ACInput *input = data; 911 911 input->pointer_x = wl_fixed_to_int(sx); 912 912 input->pointer_y = wl_fixed_to_int(sy); 913 + // Hide the Wayland compositor cursor — ac-native renders its own. 914 + wl_pointer_set_cursor(ptr, serial, NULL, 0, 0); 913 915 } 914 916 915 917 static void wl_pointer_leave(void *data, struct wl_pointer *ptr, uint32_t serial,
+1 -5
fedac/nixos/configuration.nix
··· 19 19 boot.loader.grub.timeoutStyle = lib.mkDefault "menu"; 20 20 boot.kernelPackages = pkgs.linuxPackages_latest; 21 21 boot.kernelParams = [ 22 - "loglevel=7" 23 - "systemd.show_status=1" 24 - "rd.systemd.show_status=1" 25 - "udev.log_priority=info" 26 22 "consoleblank=0" 27 23 ]; 28 - boot.consoleLogLevel = 7; 24 + boot.consoleLogLevel = 0; 29 25 30 26 # Minimal system — no desktop, no SSH, no docs 31 27 documentation.enable = false;
+4 -1
fedac/nixos/flake.nix
··· 18 18 builtins.path { 19 19 path = nativeSrcPath; 20 20 name = "ac-native-source"; 21 + # Exclude build artifacts (device nodes in initramfs-root/dev/ crash nix) 22 + filter = path: type: 23 + !(lib.hasInfix "/build/" (toString path)); 21 24 } 22 25 else 23 26 throw "AC_NIX_NATIVE_SRC is required for fedac/nixos builds; run nix with --impure and point it at fedac/native."; ··· 60 63 config = imageSystem.config; 61 64 format = "raw"; 62 65 onlyNixStore = false; 63 - partitionTableType = "hybrid"; 66 + partitionTableType = "efi"; 64 67 installBootLoader = true; 65 68 touchEFIVars = false; 66 69 copyChannel = false;
+19 -12
fedac/nixos/modules/image.nix
··· 1 1 { lib, ... }: 2 2 3 3 { 4 - # Raw disk image builds need a full installed bootloader, not the live ISO path. 5 - boot.loader.systemd-boot.enable = lib.mkForce false; 4 + # Use systemd-boot for fast EFI boot (GRUB adds ~2min on USB drives). 5 + boot.loader.systemd-boot.enable = lib.mkForce true; 6 + boot.loader.grub.enable = lib.mkForce false; 6 7 boot.loader.efi.canTouchEfiVariables = lib.mkForce false; 7 - boot.loader.grub = { 8 - enable = true; 9 - devices = [ "/dev/vda" ]; 10 - efiSupport = true; 11 - efiInstallAsRemovable = true; 12 - configurationLimit = 1; 13 - }; 14 8 boot.loader.timeout = lib.mkForce 0; 15 - boot.loader.grub.timeoutStyle = lib.mkForce "hidden"; 16 9 boot.growPartition = lib.mkDefault true; 17 10 18 - # Make early boot text visible on the real display for debug + fallback boot paths. 19 - boot.kernelParams = lib.mkAfter [ "console=tty0" ]; 11 + # Quiet boot — suppress kernel/systemd text, go straight to ac-native. 12 + # Suppress NixOS initrd "stage 1" / "stage 2" banners 13 + boot.initrd.verbose = false; 14 + 15 + # Silent boot: send all kernel/initrd/systemd output to tty2 (invisible). 16 + # tty1 stays black until cage takes over with ac-native. 17 + boot.kernelParams = lib.mkAfter [ 18 + "console=tty2" 19 + "quiet" 20 + "loglevel=0" 21 + "rd.systemd.show_status=false" 22 + "systemd.show_status=false" 23 + "vt.global_cursor_default=0" 24 + "splash" 25 + ]; 26 + boot.consoleLogLevel = lib.mkForce 0; 20 27 21 28 # Match nixpkgs raw-disk expectations so the installed image can boot on 22 29 # real hardware and expand cleanly after flashing.
+3
fedac/nixos/modules/kiosk.nix
··· 125 125 SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; 126 126 ALSA_PLUGIN_DIR = "${pkgs.alsa-plugins}/lib/alsa-lib"; 127 127 ALSA_CONFIG_PATH = "${pkgs.alsa-lib}/share/alsa/alsa.conf"; 128 + # Hide the Wayland compositor cursor — ac-native renders its own. 129 + WLR_NO_HARDWARE_CURSORS = "1"; 130 + XCURSOR_SIZE = "1"; 128 131 }; 129 132 130 133 serviceConfig = {