1 { config, lib, modulesPath, pkgs, ... }:
3 inherit (lib) findSingle mkForce 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
17 boot.initrd.availableKernelModules = [ "squashfs" ];
19 fileSystems = mkVMOverride {
20 "${storeMountPath}" = {
22 lookupDriveDeviceName "nixstore" config.virtualisation.qemu.drives;
29 system.build.squashfsStore =
30 pkgs.callPackage (modulesPath + "/../lib/make-squashfs.nix") {
31 storeContents = config.virtualisation.pathsInNixDB;
36 # This should be the default.
37 bootDevice = lookupDriveDeviceName "root" config.virtualisation.qemu.drives;
39 sharedDirectories = mkForce { };
43 file = "${config.system.build.squashfsStore}";