Skip to content
This repository was archived by the owner on Mar 23, 2025. It is now read-only.

Commit 3e44284

Browse files
authored
Merge pull request #119 from jleeuwes/make-serial-console-optional
Add raspberry-pi-nix.serial-console.enable option
2 parents b9f91f7 + 824ce25 commit 3e44284

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

rpi/default.nix

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ in
7777

7878
package = mkPackageOption pkgs "uboot-rpi-arm64" { };
7979
};
80+
serial-console = {
81+
enable = mkOption {
82+
default = true;
83+
type = types.bool;
84+
description = ''
85+
Whether to enable a console on serial0.
86+
87+
Corresponds with raspi-config's setting
88+
"Would you like a login shell to be accessible over serial?"
89+
'';
90+
};
91+
};
8092
};
8193
};
8294

@@ -319,11 +331,14 @@ in
319331
boot = {
320332
kernelParams =
321333
if cfg.uboot.enable then [ ]
322-
else [
323-
"console=tty1"
324-
# https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108
325-
"console=serial0,115200n8"
326-
"init=/sbin/init"
334+
else builtins.concatLists [
335+
[ "console=tty1" ]
336+
(if cfg.serial-console.enable then [
337+
# https://github.com/raspberrypi/firmware/issues/1539#issuecomment-784498108
338+
"console=serial0,115200n8"
339+
] else [ ]
340+
)
341+
[ "init=/sbin/init" ]
327342
];
328343
initrd = {
329344
availableKernelModules = [

0 commit comments

Comments
 (0)