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
17 fileSystems = mkVMOverride {
18 "${storeMountPath}" = {
20 lookupDriveDeviceName "nixstore" config.virtualisation.qemu.drives;
27 # We use this to disable fsck runs on the ext4 nix store image because stage-1
28 # fsck crashes (maybe because the device is read-only?), halting boot.
29 boot.initrd.checkJournalingFS = false;
31 system.build.nixStoreImage =
32 import (modulesPath + "/../lib/make-disk-image.nix") {
33 inherit pkgs config lib;
35 (config.virtualisation.host.pkgs.closureInfo {
36 rootPaths = config.virtualisation.additionalPaths;
41 partitionTableType = "none";
42 installBootLoader = false;
44 additionalSpace = "0M";
50 sharedDirectories = mkForce { };
54 file = "${config.system.build.nixStoreImage}/nixos.img";