mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 12:29:02 +02:00
nixos/systemd-stage-1: Remove unnecessary binaries
We can make the growfs and makefs binaries conditional because we know if we'll need them. Also move the cryptsetup generator to the luksroot so it's not included when not needed. We drop some generators altogether: systemd-getty-generator because we don't have getty anyway in stage 1, systemd-system-update-generator because we don't use that logic in NixOS and systemd-veritysetup-generator because stage 1 has no veritysetup support (yet) and if it had, we still wouldn't want to include the generator unconditionally.
This commit is contained in:
parent
5b47056b7d
commit
0411b51a00
|
@ -992,6 +992,7 @@ in
|
|||
];
|
||||
storePaths = [
|
||||
"${config.boot.initrd.systemd.package}/lib/systemd/systemd-cryptsetup"
|
||||
"${config.boot.initrd.systemd.package}/lib/systemd/system-generators/systemd-cryptsetup-generator"
|
||||
];
|
||||
|
||||
};
|
||||
|
|
|
@ -105,6 +105,9 @@ let
|
|||
opts = options ++ optional autoFormat "x-systemd.makefs" ++ optional autoResize "x-systemd.growfs";
|
||||
in "${device} /sysroot${mountPoint} ${fsType} ${lib.concatStringsSep "," opts}") fileSystems);
|
||||
|
||||
needMakefs = lib.any (fs: fs.autoFormat) fileSystems;
|
||||
needGrowfs = lib.any (fs: fs.autoResize) fileSystems;
|
||||
|
||||
kernel-name = config.boot.kernelPackages.kernel.name or "kernel";
|
||||
modulesTree = config.system.modulesTree.override { name = kernel-name + "-modules"; };
|
||||
firmware = config.hardware.firmware;
|
||||
|
@ -360,18 +363,22 @@ in {
|
|||
storePaths = [
|
||||
# systemd tooling
|
||||
"${cfg.package}/lib/systemd/systemd-fsck"
|
||||
"${cfg.package}/lib/systemd/systemd-growfs"
|
||||
(lib.mkIf needGrowfs "${cfg.package}/lib/systemd/systemd-growfs")
|
||||
"${cfg.package}/lib/systemd/systemd-hibernate-resume"
|
||||
"${cfg.package}/lib/systemd/systemd-journald"
|
||||
"${cfg.package}/lib/systemd/systemd-makefs"
|
||||
(lib.mkIf needMakefs "${cfg.package}/lib/systemd/systemd-makefs")
|
||||
"${cfg.package}/lib/systemd/systemd-modules-load"
|
||||
"${cfg.package}/lib/systemd/systemd-remount-fs"
|
||||
"${cfg.package}/lib/systemd/systemd-shutdown"
|
||||
"${cfg.package}/lib/systemd/systemd-sulogin-shell"
|
||||
"${cfg.package}/lib/systemd/systemd-sysctl"
|
||||
|
||||
# additional systemd directories
|
||||
"${cfg.package}/lib/systemd/system-generators"
|
||||
# generators
|
||||
"${cfg.package}/lib/systemd/system-generators/systemd-debug-generator"
|
||||
"${cfg.package}/lib/systemd/system-generators/systemd-fstab-generator"
|
||||
"${cfg.package}/lib/systemd/system-generators/systemd-gpt-auto-generator"
|
||||
"${cfg.package}/lib/systemd/system-generators/systemd-hibernate-resume-generator"
|
||||
"${cfg.package}/lib/systemd/system-generators/systemd-run-generator"
|
||||
|
||||
# utilities needed by systemd
|
||||
"${cfg.package.util-linux}/bin/mount"
|
||||
|
@ -409,8 +416,8 @@ in {
|
|||
mkdir -p $out/etc/systemd/system
|
||||
touch $out/etc/systemd/system/systemd-{makefs,growfs}@.service
|
||||
'')];
|
||||
services."systemd-makefs@".unitConfig.IgnoreOnIsolate = true;
|
||||
services."systemd-growfs@".unitConfig.IgnoreOnIsolate = true;
|
||||
services."systemd-makefs@" = lib.mkIf needMakefs { unitConfig.IgnoreOnIsolate = true; };
|
||||
services."systemd-growfs@" = lib.mkIf needGrowfs { unitConfig.IgnoreOnIsolate = true; };
|
||||
|
||||
services.initrd-nixos-activation = {
|
||||
after = [ "initrd-fs.target" ];
|
||||
|
|
Loading…
Reference in a new issue