mirror of
https://github.com/Nexoniarz/nexoniarz-config-nixos.git
synced 2026-11-03 12:34:27 +00:00
Add RTL-SDR support; switch to Limine + SDDM; drop Hyprland-era leftovers
RTL-SDR Blog V4. The V4 swapped the R820T2 tuner for an R828D behind a built-in HF upconverter, so it needs the rtlsdrblog fork of librtlsdr -- the stock Osmocom one reports no supported devices. pkgs.rtl-sdr on this channel already is that fork (rtl-sdr-blog 1.3.5), so hardware.rtl-sdr's default package is correct as-is. That also blacklists the DVB-T drivers that otherwise grab the dongle on plug-in, and ships udev rules handing it to plugdev at 0660 -- hence plugdev in the user's groups, or every SDR app needs root. Apps: SDR++ and rtl_433; the rtl_* CLI tools come with the driver. Both SDR apps are overridden to drop hardware we do not own. SDR++ and rtl_433 default to supporting every radio ever made, which pulled in UHD (1.4 GB of USRP firmware), BladeRF and LimeSuite. gqrx was the original choice but reaches UHD through gr-osmosdr's gr-uhd feature; SDR++ uses no GNU Radio at all. Per-package overrides rather than a global overlay, so nothing else is affected. Bootloader: systemd-boot -> Limine, themed to match the Gruvbox icon theme. Limine installs to its own EFI directory and adds its own NVRAM entry, so systemd-boot stays on the ESP as a firmware-menu fallback. Display manager: lightdm -> SDDM with wayland.enable. Budgie in this channel ships only a Wayland session (labwc) and was already running as one; lightdm just handles that badly. SDDM's greeter runs on weston, not kwin, so no KDE compositor comes along. Qt defaults over Budgie's GTK/MATE apps. The Budgie module force-enables gnome-terminal and installs nemo, eom, pluma, atril, engrampa, mate-calc and mate-system-monitor; environment.budgie.excludePackages drops all of them in favour of konsole, dolphin, gwenview, kate, okular, ark, kcalc and plasma-systemmonitor. default-apps.nix rewritten to match: 113 associations, video to vlc, audio to elisa, text/code to kate, and /etc/xdg/xdg-terminals.list pointing at konsole. Fixes a real bug there -- inode/directory was mapped to gwenview, so folders opened in the image viewer. Hyprland-era leftovers removed. system-telemetry and weather-fetch fed Quickshell panels that no longer exist; brightness-ctl and hotspot-start lost their keybinds. jq went with weather-fetch. Also dropped gnome-screenshot, playerctl and imv. vault-toggle and strip-metadata stay -- they never depended on Hyprland. Comments trimmed throughout: deleted anything restating the code, kept the ones recording a why you cannot recover by reading it (systemd.gpt_auto, disable_ertm, ptrace_scope, the stable ethernet MAC, the mimeapps.list parser gotcha). system.nix went 225 -> 166 lines. README rewritten -- it still described Hyprland, Quickshell and Kitty. Screenshot dropped.
This commit is contained in:
parent
d332ed2ef6
commit
33bf94bd4c
14 changed files with 177 additions and 396 deletions
|
|
@ -1,56 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Brightness control abstraction: prefers the kernel backlight class (laptop
|
||||
# panels, via brightnessctl); falls back to DDC/CI over I2C (external
|
||||
# monitors, via ddcutil) when no backlight device exists. Keeps the rest of
|
||||
# the config (Quickshell's brightness popup) hardware-agnostic.
|
||||
set -euo pipefail
|
||||
|
||||
has_backlight() {
|
||||
[ -n "$(ls -A /sys/class/backlight 2>/dev/null)" ]
|
||||
}
|
||||
|
||||
case "${1:-get}" in
|
||||
get)
|
||||
if has_backlight; then
|
||||
brightnessctl -m | cut -d, -f4 | tr -d '%'
|
||||
else
|
||||
ddcutil getvcp 10 --brief 2>/dev/null | awk '{print $4}'
|
||||
fi
|
||||
;;
|
||||
set)
|
||||
pct="${2:?usage: brightness-ctl set <0-100>}"
|
||||
if has_backlight; then
|
||||
brightnessctl set "${pct}%" > /dev/null
|
||||
else
|
||||
ddcutil setvcp 10 "$pct" > /dev/null
|
||||
fi
|
||||
;;
|
||||
up|down)
|
||||
# brightnessctl takes a relative step directly, but ddcutil's
|
||||
# setvcp only takes an absolute value — so the DDC/CI path (this
|
||||
# machine's AOC 27G2G8 has no backlight device, so it always takes
|
||||
# this path) has to read the current level and clamp the step
|
||||
# itself.
|
||||
step="${2:-5}"
|
||||
if has_backlight; then
|
||||
if [ "$1" = "up" ]; then
|
||||
brightnessctl set "+${step}%" > /dev/null
|
||||
else
|
||||
brightnessctl set "${step}%-" > /dev/null
|
||||
fi
|
||||
else
|
||||
cur=$(ddcutil getvcp 10 --brief 2>/dev/null | awk '{print $4}')
|
||||
cur="${cur:-50}"
|
||||
if [ "$1" = "up" ]; then
|
||||
new=$(( cur + step > 100 ? 100 : cur + step ))
|
||||
else
|
||||
new=$(( cur - step < 0 ? 0 : cur - step ))
|
||||
fi
|
||||
ddcutil setvcp 10 "$new" > /dev/null
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "usage: brightness-ctl [get|set <0-100>|up [step]|down [step]]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Starts a Wi-Fi hotspot with explicit security/band control — the simple
|
||||
# `nmcli device wifi hotspot` one-liner doesn't expose those.
|
||||
# hotspot-start <ssid> <password> <wpa2|wpa3> <auto|bg|a>
|
||||
set -euo pipefail
|
||||
|
||||
ssid="${1:?usage: hotspot-start <ssid> <password> <wpa2|wpa3> <auto|bg|a>}"
|
||||
password="${2:?password required}"
|
||||
security="${3:-wpa2}"
|
||||
band="${4:-auto}"
|
||||
|
||||
iface=$(nmcli -t -f DEVICE,TYPE device | awk -F: '$2=="wifi"{print $1; exit}')
|
||||
if [ -z "$iface" ]; then
|
||||
echo "No Wi-Fi device found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Idempotent: drop any previous Hotspot profile from an earlier run first.
|
||||
nmcli connection delete Hotspot >/dev/null 2>&1 || true
|
||||
|
||||
key_mgmt="wpa-psk"
|
||||
[ "$security" = "wpa3" ] && key_mgmt="sae"
|
||||
|
||||
nmcli connection add type wifi ifname "$iface" con-name Hotspot autoconnect no ssid "$ssid" > /dev/null
|
||||
nmcli connection modify Hotspot 802-11-wireless.mode ap
|
||||
if [ "$band" != "auto" ]; then
|
||||
nmcli connection modify Hotspot 802-11-wireless.band "$band"
|
||||
fi
|
||||
nmcli connection modify Hotspot wifi-sec.key-mgmt "$key_mgmt"
|
||||
nmcli connection modify Hotspot wifi-sec.psk "$password"
|
||||
nmcli connection modify Hotspot ipv4.method shared
|
||||
|
||||
nmcli connection up Hotspot
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Single-shot system telemetry snapshot — CPU/RAM/GPU/VRAM/disk usage — as
|
||||
# one JSON object, so the Quickshell System panel can poll this on a Timer
|
||||
# instead of spawning half a dozen separate processes every tick.
|
||||
set -euo pipefail
|
||||
|
||||
# --- CPU ---
|
||||
# /proc/stat's first line ("cpu ...") is cumulative jiffies since boot —
|
||||
# computing instantaneous usage needs two samples across a short gap, so
|
||||
# both reads happen inside this one invocation rather than needing
|
||||
# cross-poll state kept on the QML side.
|
||||
read_cpu() {
|
||||
read -r _ user nice system idle iowait irq softirq steal _ < /proc/stat
|
||||
echo "$((user + nice + system + irq + softirq + steal)) $((user + nice + system + idle + iowait + irq + softirq + steal))"
|
||||
}
|
||||
read -r cpu_busy1 cpu_total1 <<< "$(read_cpu)"
|
||||
sleep 0.2
|
||||
read -r cpu_busy2 cpu_total2 <<< "$(read_cpu)"
|
||||
cpu_busy_delta=$((cpu_busy2 - cpu_busy1))
|
||||
cpu_total_delta=$((cpu_total2 - cpu_total1))
|
||||
cpu_pct=0
|
||||
[ "$cpu_total_delta" -gt 0 ] && cpu_pct=$((100 * cpu_busy_delta / cpu_total_delta))
|
||||
|
||||
# --- RAM ---
|
||||
mem_total_kb=$(awk '/^MemTotal:/{print $2}' /proc/meminfo)
|
||||
mem_avail_kb=$(awk '/^MemAvailable:/{print $2}' /proc/meminfo)
|
||||
mem_used_kb=$((mem_total_kb - mem_avail_kb))
|
||||
|
||||
# --- GPU / VRAM ---
|
||||
# NVIDIA checked first via nvidia-smi (works regardless of which DRM card
|
||||
# index the driver landed on); AMD falls back to the card0 sysfs counters
|
||||
# directly — whichever's actually present decides which branch fires, so
|
||||
# this works unmodified on either machine.
|
||||
gpu_pct=-1
|
||||
vram_used_mb=-1
|
||||
vram_total_mb=-1
|
||||
if command -v nvidia-smi > /dev/null 2>&1 && nvidia-smi -L > /dev/null 2>&1; then
|
||||
nv_out="$(nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total --format=csv,noheader,nounits -i 0 2>/dev/null | tr -d ' ')"
|
||||
IFS=',' read -r gpu_pct vram_used_mb vram_total_mb <<< "$nv_out"
|
||||
elif [ -e /sys/class/drm/card0/device/gpu_busy_percent ]; then
|
||||
gpu_pct="$(cat /sys/class/drm/card0/device/gpu_busy_percent 2>/dev/null || echo -1)"
|
||||
if [ -e /sys/class/drm/card0/device/mem_info_vram_used ]; then
|
||||
vram_used_mb=$(($(cat /sys/class/drm/card0/device/mem_info_vram_used) / 1024 / 1024))
|
||||
vram_total_mb=$(($(cat /sys/class/drm/card0/device/mem_info_vram_total) / 1024 / 1024))
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- Disks (root + home) ---
|
||||
# Positional ($NF for mountpoint), not header-text matching — `df -h`'s
|
||||
# header is locale-translated (verified live: "System plików"/"%uż." under
|
||||
# this machine's pl_PL locale, not "Filesystem"/"Use%"), so matching on
|
||||
# English header text would silently find nothing.
|
||||
disks_json="$(df -h 2>/dev/null | awk '
|
||||
NR == 1 { next }
|
||||
$NF == "/" || $NF == "/home" {
|
||||
gsub(/%/, "", $5)
|
||||
printf "%s{\"mount\":\"%s\",\"size\":\"%s\",\"used\":\"%s\",\"avail\":\"%s\",\"pct\":\"%s\"}", (n++ ? "," : ""), $NF, $2, $3, $4, $5
|
||||
}
|
||||
')"
|
||||
|
||||
printf '{"cpuPct":%s,"memUsedKb":%s,"memTotalKb":%s,"gpuPct":%s,"vramUsedMb":%s,"vramTotalMb":%s,"disks":[%s]}\n' \
|
||||
"$cpu_pct" "$mem_used_kb" "$mem_total_kb" "$gpu_pct" "$vram_used_mb" "$vram_total_mb" "$disks_json"
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Fetches current weather + a short hourly forecast from Open-Meteo (free,
|
||||
# no API key/account needed) for either the machine's IP-geolocated
|
||||
# position (default, via ip-api.com — also free/keyless) or an explicitly
|
||||
# named city, and prints one combined JSON object.
|
||||
set -euo pipefail
|
||||
|
||||
city="${1:-}"
|
||||
|
||||
if [ -n "$city" ]; then
|
||||
encoded="$(jq -sRr @uri <<< "$city")"
|
||||
geo="$(curl -s "https://geocoding-api.open-meteo.com/v1/search?count=1&name=$encoded")"
|
||||
lat="$(jq -r '.results[0].latitude // empty' <<< "$geo")"
|
||||
lon="$(jq -r '.results[0].longitude // empty' <<< "$geo")"
|
||||
place="$(jq -r '.results[0].name // empty' <<< "$geo")"
|
||||
country="$(jq -r '.results[0].country // empty' <<< "$geo")"
|
||||
else
|
||||
ipgeo="$(curl -s "http://ip-api.com/json/")"
|
||||
lat="$(jq -r '.lat // empty' <<< "$ipgeo")"
|
||||
lon="$(jq -r '.lon // empty' <<< "$ipgeo")"
|
||||
place="$(jq -r '.city // empty' <<< "$ipgeo")"
|
||||
country="$(jq -r '.country // empty' <<< "$ipgeo")"
|
||||
fi
|
||||
|
||||
if [ -z "$lat" ] || [ -z "$lon" ]; then
|
||||
echo '{"error":"location lookup failed"}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
weather="$(curl -s "https://api.open-meteo.com/v1/forecast?latitude=$lat&longitude=$lon¤t=temperature_2m,weather_code,wind_speed_10m,precipitation&hourly=temperature_2m,weather_code,precipitation_probability&timezone=auto&forecast_days=2")"
|
||||
|
||||
jq --arg place "$place" --arg country "$country" '. + {place: $place, country: $country}' <<< "$weather"
|
||||
Loading…
Reference in a new issue