1 { config, lib, modulesPath, pkgs, ... }:
3 inherit (lib) findSingle mkForce mkIf mkMerge mkVMOverride;
5 lookupDriveDeviceName = driveName: driveList:
6 (findSingle (drive: drive.name == driveName)
7 (throw "Drive ${driveName} not found")
8 (throw "Multiple drives named ${driveName}") driveList).device;
10 storeMountPath = if config.virtualisation.writableStore then
18 boot.initrd.availableKernelModules = [ "squashfs" ];
20 fileSystems = mkVMOverride {
21 "${storeMountPath}" = {
23 lookupDriveDeviceName "nixstore" config.virtualisation.qemu.drives;
30 system.build.squashfsStore =
31 pkgs.callPackage (modulesPath + "/../lib/make-squashfs.nix") {
32 storeContents = config.virtualisation.additionalPaths;
37 sharedDirectories = mkForce { };
41 file = "${config.system.build.squashfsStore}";
51 (mkIf (lib.version < "23.05") {
52 # This should always have been the default.
53 virtualisation.bootDevice =
54 lookupDriveDeviceName "root" config.virtualisation.qemu.drives;