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. # 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

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