Skip to content

Commit 12120d4

Browse files
committed
nixos-modules/microvm/store-disk: do not detect the hardened profile with blacklistedKernelModules
1 parent 5544916 commit 12120d4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

nixos-modules/microvm/store-disk.nix

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ in
2424
options.microvm = with lib; {
2525
storeDiskType = mkOption {
2626
type = types.enum [ "squashfs" "erofs" ];
27-
# nixos/modules/profiles/hardened.nix forbids erofs
28-
default =
29-
if builtins.elem "erofs" config.boot.blacklistedKernelModules
30-
then "squashfs"
31-
else "erofs";
3227
description = ''
3328
Boot disk file system type: squashfs is smaller, erofs is supposed to be faster.
3429
'';
@@ -44,6 +39,16 @@ in
4439

4540
config = lib.mkMerge [
4641
(lib.mkIf (config.microvm.guest.enable && config.microvm.storeOnDisk) {
42+
# nixos/modules/profiles/hardened.nix forbids erofs.
43+
# HACK: Other NixOS modules populate
44+
# config.boot.blacklistedKernelModules depending on the boot
45+
# filesystems, so checking on that directly would result in an
46+
# infinite recursion.
47+
microvm.storeDiskType = lib.mkDefault (
48+
if config.security.virtualisation.flushL1DataCache == "always"
49+
then "squashfs"
50+
else "erofs"
51+
);
4752
boot.initrd.availableKernelModules = [
4853
config.microvm.storeDiskType
4954
];

0 commit comments

Comments
 (0)