+3
.git-blame-ignore-revs
+3
.git-blame-ignore-revs
+130
-94
nixos/maintainers/scripts/ec2/amazon-image.nix
+130
-94
nixos/maintainers/scripts/ec2/amazon-image.nix
···# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html#timeout-nvme-ebs-volumes······---arg root_logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$rootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \---arg boot_logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$bootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \---arg logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$diskImage" | ${pkgs.jq}/bin/jq '."virtual-size"')" \
···# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html#timeout-nvme-ebs-volumes+if versionAtLeast config.boot.kernelPackages.kernel.version "4.15" then "4294967295" else "255";······+--arg root_logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$rootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \+--arg boot_logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$bootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \+--arg logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$diskImage" | ${pkgs.jq}/bin/jq '."virtual-size"')" \
+35
-18
nixos/maintainers/scripts/openstack/openstack-image-zfs.nix
+35
-18
nixos/maintainers/scripts/openstack/openstack-image-zfs.nix
···# nix-build '<nixpkgs/nixos>' -A config.system.build.openstackImage --arg configuration "{ imports = [ ./nixos/maintainers/scripts/openstack/openstack-image.nix ]; }"·········pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
···# nix-build '<nixpkgs/nixos>' -A config.system.build.openstackImage --arg configuration "{ imports = [ ./nixos/maintainers/scripts/openstack/openstack-image.nix ]; }"·········pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
+30
-13
nixos/modules/virtualisation/azure-image.nix
+30
-13
nixos/modules/virtualisation/azure-image.nix
·········
·········
+48
-26
nixos/modules/virtualisation/digital-ocean-image.nix
+48
-26
nixos/modules/virtualisation/digital-ocean-image.nix
············
············
+38
nixos/modules/virtualisation/disk-size-option.nix
+38
nixos/modules/virtualisation/disk-size-option.nix
···
···+message = "Setting virtualisation.diskSize to `auto` is not supported by the current image build or vm runner; use an explicit size.";
+30
-13
nixos/modules/virtualisation/google-compute-image.nix
+30
-13
nixos/modules/virtualisation/google-compute-image.nix
············
············
+28
-11
nixos/modules/virtualisation/hyperv-image.nix
+28
-11
nixos/modules/virtualisation/hyperv-image.nix
·········
·········
+23
-11
nixos/modules/virtualisation/linode-image.nix
+23
-11
nixos/modules/virtualisation/linode-image.nix
·········
·········
+16
-3
nixos/modules/virtualisation/oci-image.nix
+16
-3
nixos/modules/virtualisation/oci-image.nix
·········
·········
+19
-7
nixos/modules/virtualisation/oci-options.nix
+19
-7
nixos/modules/virtualisation/oci-options.nix
······
······
+187
-143
nixos/modules/virtualisation/proxmox-image.nix
+187
-143
nixos/modules/virtualisation/proxmox-image.nix
···············Defaults to 'legacy' for 'proxmox.qemuConf.bios="seabios"' (default), other bios values defaults to 'efi'.···-supportBios = partitionTableType == "legacy" || partitionTableType == "hybrid" || partitionTableType == "legacy+gpt";--c ${cfgFile "qemu-server.conf" (cfg.qemuConf // cfg.qemuExtraConf)}/qemu-server.conf drive-virtio0=$diskImage-echo "file vma $out/vzdump-qemu-${cfg.filenameSuffix}.vma.zst" > $out/nix-support/hydra-build-products-# Even if there is a separate no-fs partition ("/dev/disk/by-partlabel/no-fs" i.e. "/dev/vda2"),-proxmox.qemuExtraConf.${cfg.cloudInit.device} = "${cfg.cloudInit.defaultStorage}:vm-9999-cloudinit,media=cdrom";
···············Defaults to 'legacy' for 'proxmox.qemuConf.bios="seabios"' (default), other bios values defaults to 'efi'.···+echo "file vma $out/vzdump-qemu-${cfg.filenameSuffix}.vma.zst" > $out/nix-support/hydra-build-products+# Even if there is a separate no-fs partition ("/dev/disk/by-partlabel/no-fs" i.e. "/dev/vda2"),+proxmox.qemuExtraConf.${cfg.cloudInit.device} = "${cfg.cloudInit.defaultStorage}:vm-9999-cloudinit,media=cdrom";
+926
-818
nixos/modules/virtualisation/qemu-vm.nix
+926
-818
nixos/modules/virtualisation/qemu-vm.nix
······-NIX_DISK_IMAGE=$(readlink -f "''${NIX_DISK_IMAGE:-${toString config.virtualisation.diskImage}}") || test -z "$NIX_DISK_IMAGE"---files-from ${hostPkgs.closureInfo { rootPaths = [ config.system.build.toplevel regInfo ]; }}/store-paths \-echo \$NIX_SSL_CERT_FILE should point to a valid file if virtualisation.useHostCerts is enabled.-# We might be interested in having EFI variable storage present even if we aren't booting via UEFI, hence-# - directbooting LinuxBoot, which `kexec()s` into a UEFI environment that can boot e.g. Windows-(tag: share: "-virtfs local,path=${share.source},security_model=${share.securityModel},mount_tag=${tag}")···-(mkRenamedOptionModule [ "virtualisation" "pathsInNixDB" ] [ "virtualisation" "additionalPaths" ])-(mkRemovedOptionModule [ "virtualisation" "bootDevice" ] "This option was renamed to `virtualisation.rootDevice`, as it was incorrectly named and misleading. Take the time to review what you want to do and look at the new options like `virtualisation.{bootLoaderDevice, bootPartition}`, open an issue in case of issues.")-(mkRemovedOptionModule [ "virtualisation" "efiVars" ] "This option was removed, it is possible to provide a template UEFI variable with `virtualisation.efi.variables` ; if this option is important to you, open an issue")-(mkRemovedOptionModule [ "virtualisation" "persistBootDevice" ] "Boot device is always persisted if you use a bootloader through the root disk image ; if this does not work for your usecase, please examine carefully what `virtualisation.{bootDevice, rootDevice, bootPartition}` options offer you and open an issue explaining your need.`")-defaultText = literalExpression ''if cfg.useEFIBoot then "/dev/disk/by-label/${espFilesystemLabel}" else null'';-- `passthrough`: files are stored using the same credentials as they are created on the guest (this requires QEMU to run as root)-- `mapped-xattr`: some of the file attributes like uid, gid, mode bits and link target are stored as file attributes-- `mapped-file`: the attributes are stored in the hidden .virtfs_metadata directory. Directories exported by this security model cannot interact with other unix tools-- `none`: same as "passthrough" except the sever won't report failures if it fails to set file attributes like ownership······-defaultText = lib.literalExpression ''if config.virtualisation.interfaces == {} then [ 1 ] else [ ]'';···-default = if hostPkgs.stdenv.hostPlatform.qemuArch == pkgs.stdenv.hostPlatform.qemuArch then hostPkgs.qemu_kvm else hostPkgs.qemu;-defaultText = literalExpression "if hostPkgs.stdenv.hostPlatform.qemuArch == pkgs.stdenv.hostPlatform.qemuArch then config.virtualisation.host.pkgs.qemu_kvm else config.virtualisation.host.pkgs.qemu";-See [QEMU User Documentation](https://www.qemu.org/docs/master/system/qemu-manpage) for a complete list.···-See the [QEMU Wiki on Networking](https://wiki.qemu.org/Documentation/Networking) for details.-If enabled, the virtual machine will boot directly into the kernel instead of through a bootloader.-Read more about this feature in the [QEMU documentation on Direct Linux Boot](https://qemu-project.gitlab.io/qemu/system/linuxboot.html)-Relevant parameters such as those set in `boot.initrd` and `boot.kernelParams` are also passed to QEMU.-Additional parameters can be supplied on invocation through the environment variable `$QEMU_KERNEL_PARAMS`.-They are added to the `-append` option, see [QEMU User Documentation](https://www.qemu.org/docs/master/system/qemu-manpage) for details-For example, to let QEMU use the parent terminal as the serial console, set `QEMU_KERNEL_PARAMS="console=ttyS0"`.-This will not (re-)boot correctly into a system that has switched to a different configuration on disk.-defaultText = "\${config.system.build.initialRamdisk}/\${config.system.boot.loader.initrdFile}";······-Platform-specific flash binary for EFI variables, implementation-dependent to the EFI firmware.···-}.${pkgs.stdenv.hostPlatform.system} or (throw "Unsupported system for TPM2 emulation in QEMU"));···-virtualisation.memorySize is above 2047, but qemu is only able to allocate 2047MB RAM on 32bit max.-{ assertion = cfg.directBoot.enable || cfg.directBoot.initrd == options.virtualisation.directBoot.initrd.default;# In UEFI boot, we use a EFI-only partition table layout, thus GRUB will fail when trying to install·········-sanitizeShellIdent = s: concatMapStrings (c: if builtins.elem c alphaNumericChars then c else "_") (stringToCharacters s);-"-kernel \${NIXPKGS_QEMU_KERNEL_${sanitizeShellIdent config.system.name}:-${config.system.build.toplevel}/kernel}"-''-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo}/registration ${consoles} $QEMU_KERNEL_PARAMS"''······-[ "trans=virtio" "version=9p2000.L" "msize=${toString cfg.msize}" "x-systemd.requires=modprobe@9pnet_virtio.service" ]-options = [ "mode=1777" "strictatime" "nosuid" "nodev" "size=${toString config.boot.tmp.tmpfsSize}" ];-"/nix/store" = lib.mkIf (cfg.useNixStoreImage || cfg.mountHostNixStore) (if cfg.writableStore then {-"${config.boot.loader.efi.efiSysMountPoint}" = lib.mkIf (cfg.useBootLoader && cfg.bootPartition != null) {-boot.initrd.luks.devices = (if cfg.useDefaultFilesystems then mkVMOverride else mkDefault) {};······
······+NIX_DISK_IMAGE=$(readlink -f "''${NIX_DISK_IMAGE:-${toString config.virtualisation.diskImage}}") || test -z "$NIX_DISK_IMAGE"+echo \$NIX_SSL_CERT_FILE should point to a valid file if virtualisation.useHostCerts is enabled.+# We might be interested in having EFI variable storage present even if we aren't booting via UEFI, hence+# - directbooting LinuxBoot, which `kexec()s` into a UEFI environment that can boot e.g. Windows···+"This option was renamed to `virtualisation.rootDevice`, as it was incorrectly named and misleading. Take the time to review what you want to do and look at the new options like `virtualisation.{bootLoaderDevice, bootPartition}`, open an issue in case of issues."+"This option was removed, it is possible to provide a template UEFI variable with `virtualisation.efi.variables` ; if this option is important to you, open an issue"+"Boot device is always persisted if you use a bootloader through the root disk image ; if this does not work for your usecase, please examine carefully what `virtualisation.{bootDevice, rootDevice, bootPartition}` options offer you and open an issue explaining your need.`"+defaultText = literalExpression ''if cfg.useEFIBoot then "/dev/disk/by-label/${espFilesystemLabel}" else null'';+- `passthrough`: files are stored using the same credentials as they are created on the guest (this requires QEMU to run as root)+- `mapped-xattr`: some of the file attributes like uid, gid, mode bits and link target are stored as file attributes+- `mapped-file`: the attributes are stored in the hidden .virtfs_metadata directory. Directories exported by this security model cannot interact with other unix tools+- `none`: same as "passthrough" except the sever won't report failures if it fails to set file attributes like ownership······+defaultText = lib.literalExpression ''if config.virtualisation.interfaces == {} then [ 1 ] else [ ]'';···+defaultText = literalExpression "if hostPkgs.stdenv.hostPlatform.qemuArch == pkgs.stdenv.hostPlatform.qemuArch then config.virtualisation.host.pkgs.qemu_kvm else config.virtualisation.host.pkgs.qemu";+See [QEMU User Documentation](https://www.qemu.org/docs/master/system/qemu-manpage) for a complete list.···+See the [QEMU Wiki on Networking](https://wiki.qemu.org/Documentation/Networking) for details.+If enabled, the virtual machine will boot directly into the kernel instead of through a bootloader.+Read more about this feature in the [QEMU documentation on Direct Linux Boot](https://qemu-project.gitlab.io/qemu/system/linuxboot.html)+Relevant parameters such as those set in `boot.initrd` and `boot.kernelParams` are also passed to QEMU.+Additional parameters can be supplied on invocation through the environment variable `$QEMU_KERNEL_PARAMS`.+They are added to the `-append` option, see [QEMU User Documentation](https://www.qemu.org/docs/master/system/qemu-manpage) for details+For example, to let QEMU use the parent terminal as the serial console, set `QEMU_KERNEL_PARAMS="console=ttyS0"`.+This will not (re-)boot correctly into a system that has switched to a different configuration on disk.+defaultText = "\${config.system.build.initialRamdisk}/\${config.system.boot.loader.initrdFile}";······+Platform-specific flash binary for EFI variables, implementation-dependent to the EFI firmware.···+.${pkgs.stdenv.hostPlatform.system} or (throw "Unsupported system for TPM2 emulation in QEMU")···+virtualisation.memorySize is above 2047, but qemu is only able to allocate 2047MB RAM on 32bit max.+cfg.directBoot.enable || cfg.directBoot.initrd == options.virtualisation.directBoot.initrd.default;# In UEFI boot, we use a EFI-only partition table layout, thus GRUB will fail when trying to install·········+concatMapStrings (c: if builtins.elem c alphaNumericChars then c else "_") (stringToCharacters s);+"-kernel \${NIXPKGS_QEMU_KERNEL_${sanitizeShellIdent config.system.name}:-${config.system.build.toplevel}/kernel}"+''-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo}/registration ${consoles} $QEMU_KERNEL_PARAMS"''······+boot.initrd.luks.devices = (if cfg.useDefaultFilesystems then mkVMOverride else mkDefault) { };······
+135
-92
nixos/modules/virtualisation/virtualbox-image.nix
+135
-92
nixos/modules/virtualisation/virtualbox-image.nix
·····················-mkfs.ext4 -F -L ${cfg.extraDisk.label} $dataDiskImage -E offset=$(sectorsToBytes $START) $(sectorsToKilobytes $SECTORS)K---ostype ${if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then "Linux26_64" else "Linux26"}-VBoxManage storageattach "$vmName" --storagectl ${cfg.storageController.name} --port 0 --device 0 --type hdd \-VBoxManage storageattach "$vmName" --storagectl ${cfg.storageController.name} --port 1 --device 0 --type hdd \-VBoxManage export "$vmName" --output "$fn" --options manifest ${lib.escapeShellArgs cfg.exportParams}
·····················+mkfs.ext4 -F -L ${cfg.extraDisk.label} $dataDiskImage -E offset=$(sectorsToBytes $START) $(sectorsToKilobytes $SECTORS)K+--ostype ${if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then "Linux26_64" else "Linux26"}+VBoxManage storageattach "$vmName" --storagectl ${cfg.storageController.name} --port 0 --device 0 --type hdd \+VBoxManage storageattach "$vmName" --storagectl ${cfg.storageController.name} --port 1 --device 0 --type hdd \+VBoxManage export "$vmName" --output "$fn" --options manifest ${lib.escapeShellArgs cfg.exportParams}
+1
-1
nixos/release.nix
+1
-1
nixos/release.nix