forked from nix-community/nixos-generators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqcow.nix
40 lines (35 loc) · 1019 Bytes
/
qcow.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
config,
lib,
pkgs,
modulesPath,
specialArgs,
...
}: {
# for virtio kernel drivers
imports = [
"${toString modulesPath}/profiles/qemu-guest.nix"
];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
autoResize = true;
fsType = "ext4";
};
boot.growPartition = true;
boot.kernelParams = ["console=ttyS0"];
boot.loader.grub.device =
if (pkgs.stdenv.system == "x86_64-linux")
then (lib.mkDefault "/dev/vda")
else (lib.mkDefault "nodev");
boot.loader.grub.efiSupport = lib.mkIf (pkgs.stdenv.system != "x86_64-linux") (lib.mkDefault true);
boot.loader.grub.efiInstallAsRemovable = lib.mkIf (pkgs.stdenv.system != "x86_64-linux") (lib.mkDefault true);
boot.loader.timeout = 0;
system.build.qcow = import "${toString modulesPath}/../lib/make-disk-image.nix" {
inherit lib config pkgs;
diskSize = specialArgs.diskSize or "auto";
format = "qcow2";
partitionTableType = "hybrid";
};
formatAttr = "qcow";
fileExtension = ".qcow2";
}