reduce closure

This commit is contained in:
catvayor 2024-10-06 23:27:48 +02:00
parent 9da241d8ec
commit 7219e66992
Signed by: lbailly
GPG key ID: CE3E645251AC63F3
5 changed files with 52 additions and 8 deletions

View file

@ -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"

View file

@ -65,10 +65,16 @@ in {
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";

View file

@ -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
'';

View file

@ -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

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 =
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
'';
});