···574574 virtualisation.writableStore =
575575 mkOption {
576576 type = types.bool;
577577- default = true; # FIXME
577577+ default = cfg.mountHostNixStore;
578578+ defaultText = literalExpression "cfg.mountHostNixStore";
578579 description =
579580 lib.mdDoc ''
580581 If enabled, the Nix store in the VM is made writable by
581582 layering an overlay filesystem on top of the host's Nix
582583 store.
584584+585585+ By default, this is enabled if you mount a host Nix store.
583586 '';
584587 };
585588···713716 For applications which do a lot of reads from the store,
714717 this can drastically improve performance, but at the cost of
715718 disk space and image build time.
719719+720720+ As an alternative, you can use a bootloader which will provide you
721721+ with a full NixOS system image containing a Nix store and
722722+ avoid mounting the host nix store through
723723+ {option}`virtualisation.mountHostNixStore`.
724724+ '';
725725+ };
726726+727727+ virtualisation.mountHostNixStore =
728728+ mkOption {
729729+ type = types.bool;
730730+ default = !cfg.useNixStoreImage && !cfg.useBootLoader;
731731+ defaultText = literalExpression "!cfg.useNixStoreImage && !cfg.useBootLoader";
732732+ description = lib.mdDoc ''
733733+ Mount the host Nix store as a 9p mount.
716734 '';
717735 };
718736···933951 virtualisation.additionalPaths = [ config.system.build.toplevel ];
934952935953 virtualisation.sharedDirectories = {
936936- nix-store = mkIf (!cfg.useNixStoreImage) {
954954+ nix-store = mkIf cfg.mountHostNixStore {
937955 source = builtins.storeDir;
938956 target = "/nix/store";
939957 };