WIP: feat(systemd): switch to systemd #33

Draft
lbailly wants to merge 8 commits from lbailly/liminix:systemd into main
5 changed files with 52 additions and 8 deletions
Showing only changes of commit 7219e66992 - Show all commits

View file

@ -134,7 +134,10 @@ in {
# Set the useful PS1 prompt by default. # Set the useful PS1 prompt by default.
defaultProfile.environmentVariables.PS1 = lib.mkDefault config.defaultProfile.prompt; defaultProfile.environmentVariables.PS1 = lib.mkDefault config.defaultProfile.prompt;
defaultProfile.packages = with pkgs; [ execline ]; defaultProfile.packages = with pkgs; [
# execline
systemd
];
boot.commandLine = [ boot.commandLine = [
"panic=10 oops=panic init=/bin/init loglevel=8" "panic=10 oops=panic init=/bin/init loglevel=8"

View file

@ -51,7 +51,7 @@ let
in { in {
options = { options = {
programs.busybox = { programs.busybox = {
applets = mkOption { applets = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
description = "Applets required"; description = "Applets required";
default = []; default = [];
@ -62,13 +62,19 @@ in {
# other strings are also used # other strings are also used
description = "Other busybox config flags that do not map directly to applet names (often prefixed FEATURE_)"; description = "Other busybox config flags that do not map directly to applet names (often prefixed FEATURE_)";
type = types.attrsOf types.nonEmptyStr; type = types.attrsOf types.nonEmptyStr;
default = { }; default = { };
example = { FEATURE_DD_IBS_OBS = "y"; }; example = { FEATURE_DD_IBS_OBS = "y"; };
};
package = mkOption {
type = types.package;
readOnly = true;
internal = true;
}; };
}; };
}; };
config = { config = {
programs.busybox = { programs.busybox = {
package = busybox;
applets = minimalApplets; applets = minimalApplets;
options = { options = {
ASH_ECHO = "y"; ASH_ECHO = "y";

View file

@ -19,7 +19,7 @@ let
serviceToUnit serviceToUnit
; ;
systemd-types = import ./types.nix { inherit pkgs utils lib; }; systemd-types = import ./types.nix { inherit pkgs utils lib; busybox = config.programs.busybox.package; };
units-texts = mapAttrs' ( units-texts = mapAttrs' (
_: unit: _: unit:
@ -103,7 +103,6 @@ in
Before = [ "default.target" ]; Before = [ "default.target" ];
}; };
script = '' script = ''
#!/bin/ash
# . /etc/profile # . /etc/profile
exec /bin/ash < /dev/ttyS0 > /dev/ttyS0 2> /dev/ttyS0 exec /bin/ash < /dev/ttyS0 > /dev/ttyS0 2> /dev/ttyS0
''; '';

View file

@ -1,7 +1,8 @@
{ {
pkgs, pkgs,
lib, lib,
utils utils,
busybox
}: }:
let let
inherit (utils.systemdUtils.lib) serviceConfig unitConfig; inherit (utils.systemdUtils.lib) serviceConfig unitConfig;
@ -10,7 +11,8 @@ let
imports = [ serviceConfig ]; imports = [ serviceConfig ];
# Default path for systemd services. Should be quite minimal. # Default path for systemd services. Should be quite minimal.
config.path = lib.mkAfter [ config.path = lib.mkAfter [
pkgs.coreutils busybox
# pkgs.coreutils
# pkgs.gnugrep # pkgs.gnugrep
# pkgs.gnused # pkgs.gnused
pkgs.systemd pkgs.systemd

View file

@ -335,8 +335,28 @@ extraPkgs // {
}; };
}) { }; }) { };
writeShellScriptBin = name: text:
final.writeTextFile {
inherit name;
executable = true;
destination = "/bin/${name}";
text = ''
#!/bin/ash
${text}
'';
checkPhase = ''
${final.stdenv.shellDryRun} "$target"
'';
meta.mainProgram = name;
};
systemd = systemd =
let base = prev.systemd.override { let base = prev.systemd.override {
kbd = "";
coreutils = "";
bash = null;
bashInteractive = "";
withAcl = false; withAcl = false;
withAnalyze = false; withAnalyze = false;
withApparmor = false; withApparmor = false;
@ -389,6 +409,17 @@ extraPkgs // {
# "--optimization=s" # "--optimization=s"
"--default-library=static" "--default-library=static"
"--buildtype=minsize" "--buildtype=minsize"
# (final.lib.mesonBool "static-libsystemd" true)
# (final.lib.mesonBool "standalone-binaries" true)
# (final.lib.mesonBool "link-udev-shared" false)
# (final.lib.mesonBool "link-executor-shared" false)
# (final.lib.mesonBool "link-systemctl-shared" false)
# (final.lib.mesonBool "link-networkd-shared" false)
# (final.lib.mesonBool "link-timesyncd-shared" false)
# (final.lib.mesonBool "link-journalctl-shared" false)
# (final.lib.mesonBool "link-boot-shared" false)
# (final.lib.mesonBool "link-portabled-shared" false)
]; ];
postInstall = o.postInstall + '' postInstall = o.postInstall + ''
rm -rf $out/share rm -rf $out/share
@ -438,6 +469,9 @@ extraPkgs // {
rm $out/bin/systemd-sysext rm $out/bin/systemd-sysext
rm $out/bin/systemd-tty-ask-password-agent rm $out/bin/systemd-tty-ask-password-agent
rm $out/bin/systemd-vpick rm $out/bin/systemd-vpick
# rm $out/lib/libsystemd.a
# rm $out/lib/systemd/libsystemd-shared-256.so
''; '';
}); });