add warning for #6

This commit is contained in:
Julie B. 2021-07-10 00:00:15 +02:00
parent 7f4151712b
commit afa16606d9
3 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@ let
{
boot.miniguest.enable = true;
boot.miniguest.hypervisor = "lxc";
boot.miniguest.storeCorruptionWarning = false;
}
];
};

View File

@ -6,5 +6,11 @@ with lib;
let cfg = config.boot.miniguest;
in
mkIf (cfg.enable && cfg.hypervisor == "lxc") {
warnings = lib.optional (cfg.storeCorruptionWarning) ''
Running a guest in LXC without enabling UID mapping or otherwise confining the guest's superuser can result in host store corruption!
Double-check your container settings!
You can suppress this warning with:
boot.miniguest.storeCorruptionWarning = false;
'';
boot.isContainer = mkDefault true;
}

View File

@ -10,6 +10,11 @@ with lib;
default = "qemu";
type = types.enum [ "qemu" "lxc" ];
};
storeCorruptionWarning = mkOption {
description = "Whether to display a warning about container guests being able to corrupt the Nix store.";
default = true;
type = types.bool;
};
};
};