From 4a0b00ed4ffc46486d50cd855e797300a29eddc9 Mon Sep 17 00:00:00 2001 From: catvayor Date: Tue, 1 Oct 2024 16:43:53 +0200 Subject: [PATCH] begin minimization of systemd trivial part --- overlay.nix | 160 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 111 insertions(+), 49 deletions(-) diff --git a/overlay.nix b/overlay.nix index 74327e2..1e9b150 100644 --- a/overlay.nix +++ b/overlay.nix @@ -259,7 +259,12 @@ extraPkgs // { patches = o.patches ++ [ ./pkgs/qemu/arm-image-friendly-load-addr.patch ]; - }); in q.override { nixosTestRunner = true; sdlSupport = false; hostCpuTargets = [ "mips-softmmu" ]; }; + }); in q.override { + vde2 = null; + nixosTestRunner = true; + sdlSupport = false; + hostCpuTargets = [ "mips-softmmu" ]; + }; rsyncSmall = let r = prev.rsync.overrideAttrs(o: { @@ -330,54 +335,111 @@ extraPkgs // { }; }) { }; - systemd = prev.systemd.override { - withAcl = false; - withAnalyze = false; - withApparmor = false; - withAudit = false; - withBootloader = false; - # withCompression = true; - withCoredump = false; - withCryptsetup = false; - withRepart = false; - withDocumentation = false; - withEfi = false; - withFido2 = false; - withHomed = false; - # withHostnamed = true; - withHwdb = false; - withImportd = false; - withIptables = false; - withKmod = false; - withLibBPF = false; - withLibidn2 = false; - withLocaled = false; - withLogind = false; - withMachined = false; - withNetworkd = false; - withNss = false; - withOomd = false; - withPam = false; - withPasswordQuality = false; - withPCRE2 = false; - withPolkit = false; - withPortabled = false; - withQrencode = false; - withRemote = false; - withResolved = false; - # withShellCompletions = true; - # withSysusers = true; - withSysupdate = false; - # withTimedated = true; - # withTimesyncd = true; - withTpm2Tss = false; - withUkify = false; - withUserDb = false; - withUtmp = false; - withVmspawn = false; - withKernelInstall = false; - withLibarchive = false; - }; + systemd = + let base = prev.systemd.override { + withAcl = false; + withAnalyze = false; + withApparmor = false; + withAudit = false; + withBootloader = false; + withCompression = false; + withCoredump = false; + withCryptsetup = false; + withRepart = false; + withDocumentation = false; + withEfi = false; + withFido2 = false; + withHomed = false; + withHostnamed = false; + withHwdb = false; + withImportd = false; + withIptables = false; + withKmod = false; + withLibBPF = false; + withLibidn2 = false; + withLocaled = false; + withLogind = false; + withMachined = false; + withNetworkd = false; + withNss = false; + withOomd = false; + withPam = false; + withPasswordQuality = false; + withPCRE2 = false; + withPolkit = false; + withPortabled = false; + withQrencode = false; + withRemote = false; + withResolved = false; + withShellCompletions = false; + withSysusers = false; + withSysupdate = false; + withTimedated = false; + withTimesyncd = false; + withTpm2Tss = false; + withUkify = false; + withUserDb = false; + withUtmp = false; + withVmspawn = false; + withKernelInstall = false; + withLibarchive = false; + }; + in base.overrideAttrs (o: { + mesonFlags = o.mesonFlags ++ [ + # "--optimization=s" + "--default-library=static" + "--buildtype=minsize" + ]; + postInstall = o.postInstall + '' + rm -rf $out/share + rm $out/lib/libudev.so* + rm -rf $out/lib/systemd/catalog + rm -rf $out/lib/systemd/system-generators + rm $out/lib/systemd/systemd-backlight + rm $out/lib/systemd/systemd-battery-check + rm $out/lib/systemd/systemd-hibernate-resume + rm $out/lib/systemd/systemd-makefs + rm $out/lib/systemd/systemd-nsresourced + rm $out/lib/systemd/systemd-nsresourcework + rm $out/lib/systemd/systemd-shutdown + rm $out/lib/systemd/systemd-sleep + rm $out/lib/systemd/systemd-binfmt + rm $out/lib/systemd/systemd-growfs + rm $out/lib/systemd/systemd-mountfsd + rm $out/lib/systemd/systemd-mountwork + rm $out/lib/systemd/systemd-network-generator + rm $out/lib/systemd/systemd-pstore + rm $out/lib/systemd/systemd-remount-fs + rm $out/lib/systemd/systemd-reply-password + rm $out/lib/systemd/systemd-rfkill + rm $out/lib/systemd/systemd-socket-proxyd + rm $out/lib/systemd/systemd-ssh-proxy + rm $out/lib/systemd/systemd-storagetm + rm $out/lib/systemd/systemd-volatile-root + rm $out/lib/systemd/systemd-xdg-autostart-condition + rm -rf $out/example + rm $out/bin/bootctl + rm $out/bin/systemd-nspawn + rm $out/bin/systemd-ac-power + rm $out/bin/systemd-dissect + rm $out/bin/systemd-ask-password + rm $out/bin/systemd-cgls + rm $out/bin/systemd-cgtop + rm $out/bin/systemd-creds + rm $out/bin/systemd-delta + rm $out/bin/systemd-detect-virt + rm $out/bin/systemd-escape + rm $out/bin/systemd-id128 + rm $out/bin/systemd-machine-id-setup + rm $out/bin/systemd-path + rm $out/bin/systemd-run + rm $out/bin/systemd-socket-activate + rm $out/bin/systemd-stdio-bridge + rm $out/bin/systemd-sysext + rm $out/bin/systemd-tty-ask-password-agent + rm $out/bin/systemd-vpick + ''; + }); ubootQemuAarch64 = final.buildUBoot { defconfig = "qemu_arm64_defconfig";