diff --git a/modules/base.nix b/modules/base.nix index 1755f83..a12cd6e 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -134,7 +134,10 @@ in { # Set the useful PS1 prompt by default. defaultProfile.environmentVariables.PS1 = lib.mkDefault config.defaultProfile.prompt; - defaultProfile.packages = with pkgs; [ execline ]; + defaultProfile.packages = with pkgs; [ + # execline + systemd + ]; boot.commandLine = [ "panic=10 oops=panic init=/bin/init loglevel=8" diff --git a/modules/busybox.nix b/modules/busybox.nix index 718cafd..d22a8c3 100644 --- a/modules/busybox.nix +++ b/modules/busybox.nix @@ -51,7 +51,7 @@ let in { options = { programs.busybox = { - applets = mkOption { + applets = mkOption { type = types.listOf types.str; description = "Applets required"; default = []; @@ -62,13 +62,19 @@ in { # other strings are also used description = "Other busybox config flags that do not map directly to applet names (often prefixed FEATURE_)"; type = types.attrsOf types.nonEmptyStr; - default = { }; - example = { FEATURE_DD_IBS_OBS = "y"; }; + default = { }; + example = { FEATURE_DD_IBS_OBS = "y"; }; + }; + package = mkOption { + type = types.package; + readOnly = true; + internal = true; }; }; }; config = { programs.busybox = { + package = busybox; applets = minimalApplets; options = { ASH_ECHO = "y"; diff --git a/modules/systemd/default.nix b/modules/systemd/default.nix index 8a9a15c..6dfdc3a 100644 --- a/modules/systemd/default.nix +++ b/modules/systemd/default.nix @@ -19,7 +19,7 @@ let 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' ( _: unit: @@ -103,7 +103,6 @@ in Before = [ "default.target" ]; }; script = '' - #!/bin/ash # . /etc/profile exec /bin/ash < /dev/ttyS0 > /dev/ttyS0 2> /dev/ttyS0 ''; diff --git a/modules/systemd/types.nix b/modules/systemd/types.nix index 239f551..87c974e 100644 --- a/modules/systemd/types.nix +++ b/modules/systemd/types.nix @@ -1,7 +1,8 @@ { pkgs, lib, - utils + utils, + busybox }: let inherit (utils.systemdUtils.lib) serviceConfig unitConfig; @@ -10,7 +11,8 @@ let imports = [ serviceConfig ]; # Default path for systemd services. Should be quite minimal. config.path = lib.mkAfter [ - pkgs.coreutils + busybox + # pkgs.coreutils # pkgs.gnugrep # pkgs.gnused pkgs.systemd diff --git a/overlay.nix b/overlay.nix index 1e9b150..c79866c 100644 --- a/overlay.nix +++ b/overlay.nix @@ -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 = let base = prev.systemd.override { + kbd = ""; + coreutils = ""; + bash = null; + bashInteractive = ""; + withAcl = false; withAnalyze = false; withApparmor = false; @@ -389,6 +409,17 @@ extraPkgs // { # "--optimization=s" "--default-library=static" "--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 + '' rm -rf $out/share @@ -438,6 +469,9 @@ extraPkgs // { rm $out/bin/systemd-sysext rm $out/bin/systemd-tty-ask-password-agent rm $out/bin/systemd-vpick + + # rm $out/lib/libsystemd.a + # rm $out/lib/systemd/libsystemd-shared-256.so ''; });