From 8c97f3e2571bb6952cb88771ca14f47b6ba15e10 Mon Sep 17 00:00:00 2001 From: catvayor Date: Tue, 1 Oct 2024 11:00:15 +0200 Subject: [PATCH] agetty --- modules/systemd/default.nix | 49 ++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/modules/systemd/default.nix b/modules/systemd/default.nix index 7f6c1dc..7b28730 100644 --- a/modules/systemd/default.nix +++ b/modules/systemd/default.nix @@ -1,9 +1,53 @@ { pkgs, ... }: let inherit (pkgs.pseudofile) dir symlink; + "getty.service" = { + file = + let + login = pkgs.writeScript "login" '' + #!/bin/ash + exec /bin/ash + ''; + in + '' + [Unit] + Description="Serial shell" + + [Service] + ExecStart=${pkgs.util-linux}/bin/agetty --login-program ${login} ttyS0 + ''; + mode = "0644"; + }; + "default.target" = { + file = '' + [Unit] + Description="target to boot" + Wants=getty.service + After=getty.service + AllowIsolate=yes + ''; + }; + "sysinit.target" = { + file = '' + [Unit] + Description="sysinit.target" + ''; + }; in { config = { + kernel.config = { + CGROUPS = "y"; + DEVTMPFS = "y"; + INOTIFY_USER = "y"; + SIGNALFD = "y"; + TIMERFD = "y"; + EPOLL = "y"; + UNIX = "y"; + SYSFS = "y"; + PROC_FS = "y"; + FHANDLE = "y"; + }; boot.commandLine = [ "systemd.log_level=7" #"systemd.crash_shell=true" @@ -11,9 +55,8 @@ in filesystem = dir { etc = dir { systemd = dir { - "system.conf" = { - file = ''''; - mode = "0444"; + system = dir { + inherit "default.target" "getty.service" "sysinit.target"; }; }; };