remove some extra weight

This commit is contained in:
David 2024-05-10 00:03:43 +02:00
parent f274f19bbc
commit a087c0d135
No known key found for this signature in database
GPG key ID: AB15A6AF1101390D
5 changed files with 56 additions and 0 deletions

View file

@ -25,11 +25,52 @@ in
documentation.enable = false; documentation.enable = false;
documentation.man.man-db.enable = false; documentation.man.man-db.enable = false;
# reduce closure size through package set crafting
# where there's no otherwise globally effective
# config setting available
# TODO: some are candidates for a long-term upstream solution
nixpkgs.overlays = [
(final: prev: {
# save ~12MB by not bundling manpages
coreutils-full = prev.coreutils;
# save ~20MB by making them minimal
util-linux = prev.util-linux.override {
nlsSupport = false;
ncursesSupport = false;
systemdSupport = false;
translateManpages = false;
};
# save ~6MB by removing one bash
bashInteractive = prev.bash;
# saves ~25MB
systemd = prev.systemd.override {
pname = "systemd-slim";
withDocumentation = false;
withCoredump = false;
withFido2 = false;
withRepart = false;
withMachined = false;
withRemote = false;
withTpm2Tss = false;
withLibBPF = false;
withAudit = false;
withCompression = false;
withImportd = false;
withPortabled = false;
};
})
];
systemd.coredump.enable = false;
environment.systemPackages = [ environment.systemPackages = [
# for zapping of disko # for zapping of disko
pkgs.jq pkgs.jq
# for copying extra files of nixos-anywhere # for copying extra files of nixos-anywhere
pkgs.rsync pkgs.rsync
# for installing nixos via nixos-anywhere
config.system.build.nixos-enter
config.system.build.nixos-install
]; ];
imports = [ imports = [

View file

@ -13,6 +13,7 @@ in
../networkd.nix ../networkd.nix
../serial.nix ../serial.nix
../restore-remote-access.nix ../restore-remote-access.nix
../no-grub.nix
]; ];
options = { options = {
system.kexec-installer.name = lib.mkOption { system.kexec-installer.name = lib.mkOption {

View file

@ -6,6 +6,7 @@
../networkd.nix ../networkd.nix
../serial.nix ../serial.nix
../restore-remote-access.nix ../restore-remote-access.nix
../no-grub.nix
]; ];
# We are stateless, so just default to latest. # We are stateless, so just default to latest.

10
nix/no-grub.nix Normal file
View file

@ -0,0 +1,10 @@
{lib, ...}:{
# when grub ends up being bloat: kexec & netboot
nixpkgs.overlays = [
(final: prev: {
# we don't need grub: save ~ 60MB
grub2 = prev.coreutils;
grub2_efi = prev.coreutils;
})
];
}

View file

@ -23,6 +23,9 @@
# would pull in nano # would pull in nano
programs.nano.enable = false; programs.nano.enable = false;
# also avoids placing man pages of systemPackages
documentation.man.man-db.enable = false;
# prevents strace # prevents strace
environment.defaultPackages = lib.mkForce [ pkgs.rsync pkgs.parted pkgs.gptfdisk ]; environment.defaultPackages = lib.mkForce [ pkgs.rsync pkgs.parted pkgs.gptfdisk ];