-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to configure
bootSize
in specialArgs
Update `qcow-efi` to not define module options and use `specialArgs` as the rest of the formats, in order to improve format backend consistency. Porting all of them to module options would be cleaner though.
- Loading branch information
Showing
7 changed files
with
63 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,48 @@ | ||
{ config, lib, pkgs, modulesPath, ... }: | ||
{ | ||
config, | ||
lib, | ||
pkgs, | ||
modulesPath, | ||
specialArgs, | ||
... | ||
}: let | ||
consoles = [ "ttyS0" ] ++ | ||
(lib.optional (pkgs.stdenv.hostPlatform.isAarch) "ttyAMA0,115200") ++ | ||
(lib.optional (pkgs.stdenv.hostPlatform.isRiscV64) "ttySIF0,115200"); | ||
in { | ||
# for virtio kernel drivers | ||
imports = [ | ||
"${toString modulesPath}/profiles/qemu-guest.nix" | ||
]; | ||
|
||
options = { | ||
boot = { | ||
consoles = lib.mkOption { | ||
default = [ "ttyS0" ] ++ | ||
(lib.optional (pkgs.stdenv.hostPlatform.isAarch) "ttyAMA0,115200") ++ | ||
(lib.optional (pkgs.stdenv.hostPlatform.isRiscV64) "ttySIF0,115200"); | ||
description = "Kernel console boot flags to pass to boot.kernelParams"; | ||
example = [ "ttyS2,115200" ]; | ||
}; | ||
|
||
diskSize = lib.mkOption { | ||
default = "auto"; | ||
description = "The disk size in megabytes of the system disk image."; | ||
type = with lib.types; oneOf [ ints.positive (enum [ "auto" ])]; | ||
}; | ||
}; | ||
fileSystems."/" = { | ||
device = "/dev/disk/by-label/nixos"; | ||
autoResize = true; | ||
fsType = "ext4"; | ||
}; | ||
|
||
config = { | ||
fileSystems."/" = { | ||
device = "/dev/disk/by-label/nixos"; | ||
autoResize = true; | ||
fsType = "ext4"; | ||
}; | ||
|
||
fileSystems."/boot" = { | ||
device = "/dev/disk/by-label/ESP"; | ||
fsType = "vfat"; | ||
}; | ||
|
||
boot.growPartition = true; | ||
boot.kernelParams = map (c: "console=${c}") config.boot.consoles; | ||
boot.loader.grub.device = "nodev"; | ||
|
||
boot.loader.grub.efiSupport = true; | ||
boot.loader.grub.efiInstallAsRemovable = true; | ||
boot.loader.timeout = 0; | ||
|
||
system.build.qcow-efi = import "${toString modulesPath}/../lib/make-disk-image.nix" { | ||
inherit lib config pkgs; | ||
diskSize = config.boot.diskSize; | ||
format = "qcow2"; | ||
partitionTableType = "efi"; | ||
}; | ||
|
||
formatAttr = "qcow-efi"; | ||
fileExtension = ".qcow2"; | ||
fileSystems."/boot" = { | ||
device = "/dev/disk/by-label/ESP"; | ||
fsType = "vfat"; | ||
}; | ||
} | ||
|
||
boot.growPartition = true; | ||
boot.kernelParams = map (c: "console=${c}") consoles; | ||
boot.loader.grub.device = "nodev"; | ||
|
||
boot.loader.grub.efiSupport = true; | ||
boot.loader.grub.efiInstallAsRemovable = true; | ||
boot.loader.timeout = 0; | ||
|
||
system.build.qcow-efi = import "${toString modulesPath}/../lib/make-disk-image.nix" ({ | ||
inherit lib config pkgs; | ||
diskSize = specialArgs.diskSize or "auto"; | ||
format = "qcow2"; | ||
partitionTableType = "efi"; | ||
} // (lib.optionalAttrs ((builtins.hasAttr "bootSize" specialArgs) && specialArgs.bootSize != null) { | ||
bootSize = "${builtins.toString specialArgs.bootSize}M"; | ||
})); | ||
|
||
formatAttr = "qcow-efi"; | ||
fileExtension = ".qcow2"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters