1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# A slimmer systemd, without what a guest has no use for, as a module for
# the base system:
# nix-build pkgs/run-rig --arg base '[ base/systemd.nix ]'
# Built from source (no binary cache has it), on every nixpkgs bump, as are
# dbus, against it instead of systemd-minimal (which comes in only with
# dbus), and without X11 and AppArmor, and dbus-broker, which links
# libsystemd. The initrd gets it, too. NixOS leaves out the units of
# what the package doesn't have; coredump, which it doesn't, the base
# system turns off already.
{ config, lib, pkgs, ... }:
{
systemd.package = pkgs.systemd.override {
withApparmor = false;
withCoredump = false; # elfutils
withCryptsetup = false;
withFido2 = false;
withHomed = false;
withImportd = false; # gnupg, openldap
withLibBPF = false;
withMachined = false;
withNspawn = false;
withPasswordQuality = false;
withPortabled = false;
withQrencode = false; # so no systemd-bsod, see below
withRemote = false; # microhttpd, gnutls
withRepart = false;
withSysupdate = false;
withTpm2Tss = false;
withVmspawn = false;
};
# NixOS's initrd has systemd-bsod (emergency messages full-screen, with a
# QR code), which systemd builds only with qrencode.
boot.initrd.systemd.suppressedUnits = [ "systemd-bsod.service" ];
boot.initrd.systemd.suppressedStorePaths = [
"${config.boot.initrd.systemd.package}/lib/systemd/systemd-bsod"
];
# dbus against it, without X11 and AppArmor (which has no switch there).
services.dbus.dbusPackage = (pkgs.dbus.override {
systemdMinimal = config.systemd.package;
x11Support = false;
}).overrideAttrs (old: {
buildInputs = lib.remove pkgs.libapparmor old.buildInputs;
mesonFlags = map (f: if f == "-Dapparmor=enabled" then "-Dapparmor=disabled" else f) old.mesonFlags;
});
# It links libsystemd: with nixpkgs' systemd, the guest would have both.
services.dbus.brokerPackage = pkgs.dbus-broker.override {
systemd = config.systemd.package;
dbus = config.services.dbus.dbusPackage;
};
}
|