Rebase to flake parts #4
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
uconsole4gRuntime = with pkgs; [
|
||||
bash
|
||||
coreutils
|
||||
gnugrep
|
||||
gnused
|
||||
gawk
|
||||
util-linux
|
||||
usbutils
|
||||
pciutils
|
||||
lsb-release
|
||||
libgpiod
|
||||
modemmanager
|
||||
iproute2
|
||||
iputils
|
||||
busybox
|
||||
socat
|
||||
systemd
|
||||
];
|
||||
|
||||
# Use a lightweight wrapper to avoid ShellCheck gating the build.
|
||||
uconsole4gCm5 = pkgs.writeShellScriptBin "uconsole-4g-cm5" ''
|
||||
export PATH=${lib.makeBinPath uconsole4gRuntime}:$PATH
|
||||
exec ${pkgs.bash}/bin/bash ${./uconsole-4g-cm5.sh} "$@"
|
||||
'';
|
||||
in
|
||||
{
|
||||
networking.modemmanager.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
libgpiod
|
||||
uconsole4gCm5
|
||||
socat
|
||||
ripgrep
|
||||
];
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
{ pkgs, ... }: {
|
||||
# Keep Raspberry Pi kernel cmdline in sync with current system profile.
|
||||
system.activationScripts.updateRpiCmdline.text = ''
|
||||
export PATH="${pkgs.gnused}/bin:''${PATH}"
|
||||
for cmdline in /boot/firmware/nixos/*/cmdline.txt; do
|
||||
[ -e "$cmdline" ] || continue
|
||||
current_init="$(readlink -f /nix/var/nix/profiles/system)/init"
|
||||
if grep -q 'init=/nix/store/' "$cmdline"; then
|
||||
sed -i "s#init=/nix/store/[^ ]*/init#init=$current_init#" "$cmdline"
|
||||
fi
|
||||
if ! grep -q 'root=' "$cmdline"; then
|
||||
sed -i 's/ init=/ root=PARTUUID=4d44c78a-ee3c-4e3e-9eee-0f2eb10347b6 rootfstype=ext4 init=/' "$cmdline"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
{ ... }: {
|
||||
#TODO[epic=Moderate] Clean this up, move to host's configuration.nix.
|
||||
# Native Raspberry Pi boot flow.
|
||||
boot.loader.raspberry-pi.bootloader = "kernel";
|
||||
boot.loader.grub.enable = false;
|
||||
boot.consoleLogLevel = 7;
|
||||
boot.kernelModules = [ "nvme" ];
|
||||
|
||||
# Root device for kernel cmdline (NVMe boot).
|
||||
boot.kernelParams = [
|
||||
"root=PARTUUID=4d44c78a-ee3c-4e3e-9eee-0f2eb10347b6"
|
||||
"rootfstype=ext4"
|
||||
];
|
||||
|
||||
console = {
|
||||
earlySetup = true;
|
||||
font = "ter-v32n";
|
||||
};
|
||||
|
||||
# Enable PCIe x1 for CM5 NVMe adapter.
|
||||
hardware.raspberry-pi.config.cm5.base-dt-params.pciex1 = {
|
||||
enable = true;
|
||||
value = "on";
|
||||
};
|
||||
|
||||
powerManagement.cpuFreqGovernor = "powersave";
|
||||
|
||||
# Root + firmware as boot-critical mounts.
|
||||
fileSystems."/".neededForBoot = true;
|
||||
fileSystems."/boot/firmware".neededForBoot = true;
|
||||
|
||||
# Pi generational boot expects boot-firmware.mount to exist.
|
||||
systemd.mounts = [
|
||||
{
|
||||
what = "/dev/disk/by-label/FIRMWARE";
|
||||
where = "/boot/firmware";
|
||||
type = "vfat";
|
||||
options = "noatime,fmask=0022,dmask=0022";
|
||||
wantedBy = [ "local-fs.target" ];
|
||||
after = [ "local-fs-pre.target" ];
|
||||
}
|
||||
];
|
||||
|
||||
# There is no serial console on uConsole CM5 by default.
|
||||
systemd.services."serial-getty@ttyS0".enable = false;
|
||||
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{ ... }: {
|
||||
#TODO[epic=Moderate] Clean this up, move to host's configuration.nix.
|
||||
# Enable uinput for gamepad remap.
|
||||
hardware.uinput.enable = true;
|
||||
programs.mosh.enable = true;
|
||||
}
|
||||
Reference in New Issue
Block a user