nixos: Switch to systemd initrd
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 17m17s
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 17m17s
This commit is contained in:
@@ -94,6 +94,7 @@ in
|
||||
"net.ipv6.route.max_size" = mkDefault 16384;
|
||||
};
|
||||
};
|
||||
|
||||
loader = {
|
||||
efi = {
|
||||
efiSysMountPoint = mkDefault "/boot";
|
||||
@@ -111,6 +112,14 @@ in
|
||||
memtest86.enable = mkDefault true;
|
||||
};
|
||||
};
|
||||
|
||||
initrd = {
|
||||
systemd = {
|
||||
enable = mkDefault true;
|
||||
emergencyAccess = mkDefault true;
|
||||
};
|
||||
services.lvm.enable = mkDefault true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; mkMerge [
|
||||
|
@@ -208,7 +208,13 @@ in
|
||||
|
||||
mkdir -p -m 0755 "$root"/sbin "$root"/etc
|
||||
touch "$root"/etc/os-release
|
||||
ln -sf "${containerSystem}"/init "$root"/sbin/init
|
||||
|
||||
if [ -e "${containerSystem}"/prepare-root ]; then
|
||||
initSource="${containerSystem}"/prepare-root
|
||||
else
|
||||
initSource="${containerSystem}"/init
|
||||
fi
|
||||
ln -sf "$initSource" "$root"/sbin/init
|
||||
'';
|
||||
postStop =
|
||||
''
|
||||
|
@@ -224,8 +224,9 @@ in
|
||||
|
||||
# Catch non-existent source directories that are needed for boot (see `pathsNeededForBoot` in
|
||||
# nixos/lib/util.nix). We do this by monkey-patching the `waitDevice` function that would otherwise hang.
|
||||
boot.initrd.postDeviceCommands =
|
||||
''
|
||||
# Seems like systemd initrd doesn't care because it uses the systemd.mount units
|
||||
# ("If this mount is a bind mount and the specified path does not exist yet it is created as directory.")
|
||||
boot.initrd.postDeviceCommands = mkIf (!config.boot.initrd.systemd.enable) ''
|
||||
ensurePersistSource() {
|
||||
[ -e "/mnt-root$1" ] && return
|
||||
echo "Persistent source directory $1 does not exist, creating..."
|
||||
|
Reference in New Issue
Block a user