Merge pull request #119 from jleeuwes/make-serial-console-optional

Add raspberry-pi-nix.serial-console.enable option
This commit is contained in:
Travis Staton 2025-02-21 20:23:39 -05:00 committed by GitHub
commit 3e442842d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -77,6 +77,18 @@ in
package = mkPackageOption pkgs "uboot-rpi-arm64" { };
};
serial-console = {
enable = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable a console on serial0.
Corresponds with raspi-config's setting
"Would you like a login shell to be accessible over serial?"
'';
};
};
};
};
@ -319,11 +331,14 @@ in
boot = {
kernelParams =
if cfg.uboot.enable then [ ]
else [
"console=tty1"
# https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108
"console=serial0,115200n8"
"init=/sbin/init"
else builtins.concatLists [
[ "console=tty1" ]
(if cfg.serial-console.enable then [
# https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108
"console=serial0,115200n8"
] else [ ]
)
[ "init=/sbin/init" ]
];
initrd = {
availableKernelModules = [