From ae78f9aafd872af9ff53c1fb040b8e331faa69fd Mon Sep 17 00:00:00 2001 From: catvayor Date: Mon, 30 Sep 2024 19:38:13 +0200 Subject: [PATCH] systemd init --- lib/eval-config.nix | 2 +- modules/base.nix | 3 +-- modules/s6/scripts/rc.shutdown | 19 ------------------- modules/s6/scripts/rc.shutdown.final | 22 ---------------------- modules/s6/scripts/runlevel | 12 ------------ modules/systemd/default.nix | 25 +++++++++++++++++++++++++ overlay.nix | 10 +++++----- 7 files changed, 32 insertions(+), 61 deletions(-) delete mode 100755 modules/s6/scripts/rc.shutdown delete mode 100755 modules/s6/scripts/rc.shutdown.final delete mode 100755 modules/s6/scripts/runlevel create mode 100644 modules/systemd/default.nix diff --git a/lib/eval-config.nix b/lib/eval-config.nix index 4c3c009..986e9d5 100644 --- a/lib/eval-config.nix +++ b/lib/eval-config.nix @@ -14,7 +14,7 @@ in "${modulesPath}/busybox.nix" "${modulesPath}/hostname.nix" "${modulesPath}/kernel" - "${modulesPath}/s6" + "${modulesPath}/systemd" "${modulesPath}/users.nix" "${modulesPath}/outputs.nix" "${modulesPath}/nixpkgs.nix" diff --git a/modules/base.nix b/modules/base.nix index 5107e1e..30141a8 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -129,10 +129,9 @@ in { # By default, we enable cross-compilation support. nixpkgs.buildPlatform = lib.mkDefault builtins.currentSystem; - defaultProfile.packages = with pkgs; - [ s6 s6-init-bin execline s6-linux-init s6-rc ]; # Set the useful PS1 prompt by default. defaultProfile.environmentVariables.PS1 = lib.mkDefault config.defaultProfile.prompt; + defaultProfile.packages = with pkgs; [ execline ]; boot.commandLine = [ "panic=10 oops=panic init=/bin/init loglevel=8" diff --git a/modules/s6/scripts/rc.shutdown b/modules/s6/scripts/rc.shutdown deleted file mode 100755 index 81fac67..0000000 --- a/modules/s6/scripts/rc.shutdown +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - - -### Things to do before hardware halt/reboot/poweroff. -### Ideally, it should be a single call to the service manager, -### telling it to bring all the services down. - -### If your s6-linux-init-maker invocation was made with the -1 -### option, messages from rc.shutdown will appear on /dev/console -### as well as be logged by the catch-all logger. -### If your s6-linux-init-maker invocation did NOT include the -1 -### option, messages from rc.shutdown will only be logged by the -### catch-all logger and will NOT appear on /dev/console. In order -### to print them to /dev/console instead, you may want to -### uncomment the following line: -exec >/dev/console 2>&1 - -### If your services are managed by s6-rc: -exec s6-rc -v2 -bDa change diff --git a/modules/s6/scripts/rc.shutdown.final b/modules/s6/scripts/rc.shutdown.final deleted file mode 100755 index 5344b7a..0000000 --- a/modules/s6/scripts/rc.shutdown.final +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -e - -## s6-linux-init-shutdownd never tells s6-svscan to exit, so if -## you're running s6-linux-init, it's normal that your -## .s6-svscan/finish script is not executed. - -## The place where you want to hack things is /etc/rc.shutdown.final, -## which is run by the stage 4 script right before the hard reboot. -## So you can do dirty stuff [...] which should clean up the -## s6-supervise and the foreground, and give control to -## .s6-svscan/finish. - -## -- Laurent Bercot on skaware mailing list, -## https://skarnet.org/lists/skaware/1913.html - -exec >/dev/console 2>&1 - -# down, exit supervisor, wait, stay down -s6-svc -dxwD /run/service/s6-linux-init-shutdownd -# HUP, exit supervisor, wait, down -s6-svc -hxwd /run/service/s6-svscan-log -s6-svscanctl -b /run/service # abort diff --git a/modules/s6/scripts/runlevel b/modules/s6/scripts/runlevel deleted file mode 100755 index 3c2cfcd..0000000 --- a/modules/s6/scripts/runlevel +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -e - -### This script is called once at boot time by rc.init, and is -### also called by the runleveld service every time the user -### requests a machine state change via telinit. -### Ideally, it should just be a call to the service manager. - -test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; } - - -### If your services are managed by s6-rc: -exec s6-rc -v2 -up change "$1" diff --git a/modules/systemd/default.nix b/modules/systemd/default.nix new file mode 100644 index 0000000..7f6c1dc --- /dev/null +++ b/modules/systemd/default.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: +let + inherit (pkgs.pseudofile) dir symlink; +in +{ + config = { + boot.commandLine = [ + "systemd.log_level=7" + #"systemd.crash_shell=true" + ]; + filesystem = dir { + etc = dir { + systemd = dir { + "system.conf" = { + file = ''''; + mode = "0444"; + }; + }; + }; + bin = dir { + init = symlink "${pkgs.systemd}/bin/init"; + }; + }; + }; +} diff --git a/overlay.nix b/overlay.nix index be76616..74327e2 100644 --- a/overlay.nix +++ b/overlay.nix @@ -352,19 +352,19 @@ extraPkgs // { withLibBPF = false; withLibidn2 = false; withLocaled = false; - # withLogind = true; + withLogind = false; withMachined = false; - # withNetworkd = true; + withNetworkd = false; withNss = false; withOomd = false; - # withPam = true; - # withPasswordQuality = true; + withPam = false; + withPasswordQuality = false; withPCRE2 = false; withPolkit = false; withPortabled = false; withQrencode = false; withRemote = false; - # withResolved = true; + withResolved = false; # withShellCompletions = true; # withSysusers = true; withSysupdate = false;