Add files via upload
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# Pontiac G5 Pi AUX Unit (i dont know wtf to name this thing)
|
||||
clear
|
||||
cat <<EOF
|
||||
██╗ ██╗██████╗ ████████╗██╗ ██╗██╗ ██╗███████╗ ██████╗ ███████╗██╗ ██╗███████╗██╗ ██████╗ ██████╗ ███╗ ███╗███████╗███╗ ██╗████████╗
|
||||
██║ ██╔╝╚════██╗╚══██╔══╝╚██╗██╔╝╚██╗ ██╔╝╚══███╔╝ ██╔══██╗██╔════╝██║ ██║██╔════╝██║ ██╔═══██╗██╔══██╗████╗ ████║██╔════╝████╗ ██║╚══██╔══╝
|
||||
█████╔╝ █████╔╝ ██║ ╚███╔╝ ╚████╔╝ ███╔╝ ██║ ██║█████╗ ██║ ██║█████╗ ██║ ██║ ██║██████╔╝██╔████╔██║█████╗ ██╔██╗ ██║ ██║
|
||||
██╔═██╗ ╚═══██╗ ██║ ██╔██╗ ╚██╔╝ ███╔╝ ██║ ██║██╔══╝ ╚██╗ ██╔╝██╔══╝ ██║ ██║ ██║██╔═══╝ ██║╚██╔╝██║██╔══╝ ██║╚██╗██║ ██║
|
||||
██║ ██╗██████╔╝ ██║██╗██╔╝ ██╗ ██║ ███████╗ ██████╔╝███████╗ ╚████╔╝ ███████╗███████╗╚██████╔╝██║ ██║ ╚═╝ ██║███████╗██║ ╚████║ ██║
|
||||
╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚═════╝ ╚══════╝ ╚═══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═╝
|
||||
EOF
|
||||
|
||||
# Functions
|
||||
logger() {
|
||||
local message="$*"
|
||||
local timestamp=$(date '+%b %e %H:%M:%S') # e.g., Mar 8 14:35:22
|
||||
local hostname=$(hostname)
|
||||
local pid=$$ # PID of the current script
|
||||
echo "$timestamp g5pi[$pid]: $message"
|
||||
}
|
||||
|
||||
# bluetooth network loop
|
||||
netloop() {
|
||||
# Exit if already locked
|
||||
[[ -e /tmp/netloop ]] && return 0
|
||||
touch /tmp/netloop
|
||||
|
||||
while :; do
|
||||
# Check if "Pixel 6a Network" is active
|
||||
if ! nmcli -t -f NAME connection show --active | grep -qx "Pixel 6a Network"; then
|
||||
#echo "Connecting to Pixel 6a Network..."
|
||||
nmcli connection up "Pixel 6a Network"
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
echo "$(date) [g5pi] starting up.."
|
||||
journalctl -f &
|
||||
# bump up that aux to the highest it can be
|
||||
pactl set-sink-volume alsa_output.platform-fe00b840.mailbox.stereo-fallback 100%
|
||||
|
||||
# Bluetooth preparation
|
||||
bluetoothctl <<EOF
|
||||
power on
|
||||
agent NoInputNoOutput
|
||||
default-agent
|
||||
system-alias "Pontiac G5"
|
||||
discoverable on
|
||||
pairable on
|
||||
EOF
|
||||
|
||||
netloop &
|
||||
tail
|
||||
@@ -0,0 +1,65 @@
|
||||
{ pkgs, ... }: {
|
||||
networking.hostName = "Pontiac-G5";
|
||||
systemd.services = {
|
||||
"autovt@tty1" = {
|
||||
enable = true;
|
||||
restartIfChanged = false;
|
||||
description = "autologin service at tty1";
|
||||
after = [ "suppress-kernel-logging.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = builtins.concatStringsSep " " ([
|
||||
"@${pkgs.utillinux}/sbin/agetty"
|
||||
"agetty --login-program ${pkgs.shadow}/bin/login"
|
||||
"--autologin k3t --noclear %I $TERM"
|
||||
]);
|
||||
Restart = "always";
|
||||
Type = "idle";
|
||||
};
|
||||
};
|
||||
"suppress-kernel-logging" = {
|
||||
enable = true;
|
||||
restartIfChanged = false;
|
||||
description = "suppress kernel logging to the console";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.utillinux}/sbin/dmesg -n 1";
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# bluetooth - headless auto pair
|
||||
hardware.bluetooth.settings = {
|
||||
Policy.AutoEnable = true;
|
||||
General = {
|
||||
Name = "Pontiac G5";
|
||||
DiscoverableTimeout = 0;
|
||||
PairableTimeout = 0;
|
||||
Class = "0x200408";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.bluetooth-auto-pair = {
|
||||
description = "Bluetooth headless auto-pair agent";
|
||||
after = [ "bluetooth.service" ];
|
||||
wants = [ "bluetooth.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.bluez-tools}/bin/bt-agent -c NoInputNoOutput";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
# pipewire for audio
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = false;
|
||||
pulse.enable = true;
|
||||
};
|
||||
|
||||
systemd.user.services.pipewire.wantedBy = [ "default.target" ];
|
||||
systemd.user.services.pipewire-pulse.wantedBy = [ "default.target" ];
|
||||
}
|
||||
Reference in New Issue
Block a user