Skip to content

Commit 4e01b9e

Browse files
committed
remove some extra weight
1 parent 6a81f7e commit 4e01b9e

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

nix/installer.nix

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,54 @@
1111
}).latestCompatibleLinuxPackages;
1212
boot.zfs.removeLinuxDRM = lib.mkDefault pkgs.hostPlatform.isAarch64;
1313

14-
documentation.enable = false;
14+
documentation.enable = lib.mkForce false;
15+
16+
# reduce closure size through package set crafting
17+
# where there's no otherwise globally effective
18+
# config setting available
19+
# TODO: some are candidates for a long-term upstream solution
20+
nixpkgs.overlays = [
21+
(final: prev: {
22+
# save ~12MB by not bundling manpages
23+
coreutils-full = prev.coreutils;
24+
# save ~20MB by making them minimal
25+
util-linux = prev.util-linux.override {
26+
nlsSupport = false;
27+
ncursesSupport = false;
28+
systemdSupport = false;
29+
translateManpages = false;
30+
};
31+
# save ~6MB by removing one bash
32+
bashInteractive = prev.bash;
33+
# saves ~25MB
34+
systemd = prev.systemd.override {
35+
pname = "systemd-slim";
36+
withDocumentation = false;
37+
withCoredump = false;
38+
withFido2 = false;
39+
withRepart = false;
40+
withMachined = false;
41+
withRemote = false;
42+
withTpm2Tss = false;
43+
withLibBPF = false;
44+
withAudit = false;
45+
withCompression = false;
46+
withImportd = false;
47+
withPortabled = false;
48+
};
49+
})
50+
];
51+
systemd.coredump.enable = false;
52+
1553

1654
environment.systemPackages = [
1755
# for zapping of disko
1856
pkgs.jq
1957
# for copying extra files of nixos-anywhere
2058
pkgs.rsync
59+
# for installing nixos via nixos-anywhere
60+
config.system.build.nixos-enter
61+
config.system.build.nixos-install
2162
];
2263

2364
imports = [

nix/kexec-installer/module.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ in
1313
../networkd.nix
1414
../serial.nix
1515
../restore-remote-access.nix
16+
../no-grub.nix
1617
];
1718
options = {
1819
system.kexec-installer.name = lib.mkOption {

nix/netboot-installer/module.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
../networkd.nix
77
../serial.nix
88
../restore-remote-access.nix
9+
../no-grub.nix
910
];
1011

1112
# We are stateless, so just default to latest.

nix/no-grub.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{lib, ...}:{
2+
# when grub ends up being bloat: kexec & netboot
3+
nixpkgs.overlays = [
4+
(final: prev: {
5+
# we don't need grub: save ~ 60MB
6+
grub2 = prev.coreutils;
7+
grub2_efi = prev.coreutils;
8+
})
9+
];
10+
}

nix/noninteractive.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
# would pull in nano
2323
programs.nano.syntaxHighlight = lib.mkForce false;
24+
programs.nano.enable = false;
25+
26+
documentation.man.man-db.enable = false;
2427

2528
# prevents nano, strace
2629
environment.defaultPackages = lib.mkForce [

0 commit comments

Comments
 (0)