From 438f6f17de68353f9d453ef113c40ce6816191cd Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 16 Jul 2022 19:02:49 +0200 Subject: [PATCH] nixos/qemu-vm: Warn when wasting space --- nixos/modules/virtualisation/qemu-vm.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 3fafbbc55dd6..13030f9bd5f6 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -17,6 +17,8 @@ let cfg = config.virtualisation; + opt = options.virtualisation; + qemu = cfg.qemu.package; consoles = lib.concatMapStringsSep " " (c: "console=${c}") cfg.qemu.consoles; @@ -767,6 +769,26 @@ in } ])); + warnings = + optional ( + cfg.writableStore && + cfg.useNixStoreImage && + opt.writableStore.highestPrio > lib.modules.defaultPriority) + '' + You have enabled ${opt.useNixStoreImage} = true, + without setting ${opt.writableStore} = false. + + This causes a store image to be written to the store, which is + costly, especially for the binary cache, and because of the need + for more frequent garbage collection. + + If you really need this combination, you can set ${opt.writableStore} + explicitly to false, incur the cost and make this warning go away. + Otherwise, we recommend + + ${opt.writableStore} = false; + ''; + # Note [Disk layout with `useBootLoader`] # # If `useBootLoader = true`, we configure 2 drives: