From 5803bdb9fcacad00890d87f33f4e983d53c29628 Mon Sep 17 00:00:00 2001 From: illustris Date: Tue, 29 Apr 2025 08:41:26 +0530 Subject: [PATCH] Revert "Use mkImageMediaOverride for filesystem attributes of various images" --- nixos/modules/installer/sd-card/sd-image.nix | 2 +- nixos/modules/virtualisation/azure-image.nix | 2 +- .../virtualisation/digital-ocean-config.nix | 2 +- nixos/modules/virtualisation/disk-image.nix | 2 +- .../virtualisation/google-compute-config.nix | 2 +- nixos/modules/virtualisation/hyperv-image.nix | 18 ++++++------- nixos/modules/virtualisation/kubevirt.nix | 2 +- .../modules/virtualisation/linode-config.nix | 8 +++--- nixos/modules/virtualisation/oci-common.nix | 18 ++++++------- .../virtualisation/openstack-config.nix | 26 ++++++++----------- .../virtualisation/openstack-options.nix | 16 +++++------- .../modules/virtualisation/proxmox-image.nix | 26 +++++++------------ .../virtualisation/virtualbox-image.nix | 2 +- nixos/modules/virtualisation/vmware-image.nix | 18 ++++++------- 14 files changed, 63 insertions(+), 81 deletions(-) diff --git a/nixos/modules/installer/sd-card/sd-image.nix b/nixos/modules/installer/sd-card/sd-image.nix index 0fb725a035e3..d96216c4ae17 100644 --- a/nixos/modules/installer/sd-card/sd-image.nix +++ b/nixos/modules/installer/sd-card/sd-image.nix @@ -185,7 +185,7 @@ in config = { hardware.enableAllHardware = true; - fileSystems = lib.mkImageMediaOverride { + fileSystems = { "/boot/firmware" = { device = "/dev/disk/by-label/${config.sdImage.firmwarePartitionName}"; fsType = "vfat"; diff --git a/nixos/modules/virtualisation/azure-image.nix b/nixos/modules/virtualisation/azure-image.nix index fe28efe624c5..252381d0f198 100644 --- a/nixos/modules/virtualisation/azure-image.nix +++ b/nixos/modules/virtualisation/azure-image.nix @@ -113,7 +113,7 @@ in ''; }; - fileSystems = lib.mkImageMediaOverride { + fileSystems = { "/" = { device = "/dev/disk/by-label/${cfg.label}"; inherit (cfg) label; diff --git a/nixos/modules/virtualisation/digital-ocean-config.nix b/nixos/modules/virtualisation/digital-ocean-config.nix index 14d9b3feb1e4..a38d2d15ab84 100644 --- a/nixos/modules/virtualisation/digital-ocean-config.nix +++ b/nixos/modules/virtualisation/digital-ocean-config.nix @@ -39,7 +39,7 @@ with lib; in mkMerge [ { - fileSystems."/" = lib.mkImageMediaOverride { + fileSystems."/" = lib.mkDefault { device = "/dev/disk/by-label/nixos"; autoResize = true; fsType = "ext4"; diff --git a/nixos/modules/virtualisation/disk-image.nix b/nixos/modules/virtualisation/disk-image.nix index ef73e6d4f74a..c524b6627113 100644 --- a/nixos/modules/virtualisation/disk-image.nix +++ b/nixos/modules/virtualisation/disk-image.nix @@ -37,7 +37,7 @@ in boot.loader.systemd-boot.enable = lib.mkDefault cfg.efiSupport; boot.growPartition = lib.mkDefault true; - fileSystems = lib.mkImageMediaOverride { + fileSystems = { "/" = { device = "/dev/disk/by-label/nixos"; autoResize = true; diff --git a/nixos/modules/virtualisation/google-compute-config.nix b/nixos/modules/virtualisation/google-compute-config.nix index c112d4132920..8f9e2b4f4075 100644 --- a/nixos/modules/virtualisation/google-compute-config.nix +++ b/nixos/modules/virtualisation/google-compute-config.nix @@ -21,7 +21,7 @@ in ../profiles/qemu-guest.nix ]; - fileSystems."/" = lib.mkImageMediaOverride { + fileSystems."/" = { fsType = "ext4"; device = "/dev/disk/by-label/nixos"; autoResize = true; diff --git a/nixos/modules/virtualisation/hyperv-image.nix b/nixos/modules/virtualisation/hyperv-image.nix index f292a60d71cd..8f77d384a9ba 100644 --- a/nixos/modules/virtualisation/hyperv-image.nix +++ b/nixos/modules/virtualisation/hyperv-image.nix @@ -73,17 +73,15 @@ in inherit config lib pkgs; }; - fileSystems = lib.mkImageMediaOverride { - "/" = { - device = "/dev/disk/by-label/nixos"; - autoResize = true; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + autoResize = true; + fsType = "ext4"; + }; - "/boot" = { - device = "/dev/disk/by-label/ESP"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; }; boot.growPartition = true; diff --git a/nixos/modules/virtualisation/kubevirt.nix b/nixos/modules/virtualisation/kubevirt.nix index 6e91a8b67c6f..5e855d3af06e 100644 --- a/nixos/modules/virtualisation/kubevirt.nix +++ b/nixos/modules/virtualisation/kubevirt.nix @@ -12,7 +12,7 @@ ]; config = { - fileSystems."/" = lib.mkImageMediaOverride { + fileSystems."/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; autoResize = true; diff --git a/nixos/modules/virtualisation/linode-config.nix b/nixos/modules/virtualisation/linode-config.nix index 721a6f8bdc69..a6dbe4cbb8f0 100644 --- a/nixos/modules/virtualisation/linode-config.nix +++ b/nixos/modules/virtualisation/linode-config.nix @@ -1,8 +1,10 @@ { + config, lib, pkgs, ... }: +with lib; { imports = [ ../profiles/qemu-guest.nix ]; @@ -10,7 +12,7 @@ enable = true; settings.PermitRootLogin = "prohibit-password"; - settings.PasswordAuthentication = lib.mkDefault false; + settings.PasswordAuthentication = mkDefault false; }; networking = { @@ -32,13 +34,13 @@ sysstat ]; - fileSystems."/" = lib.mkImageMediaOverride { + fileSystems."/" = { fsType = "ext4"; device = "/dev/sda"; autoResize = true; }; - swapDevices = lib.mkDefault [ { device = "/dev/sdb"; } ]; + swapDevices = mkDefault [ { device = "/dev/sdb"; } ]; # Enable LISH and Linode Booting w/ GRUB boot = { diff --git a/nixos/modules/virtualisation/oci-common.nix b/nixos/modules/virtualisation/oci-common.nix index 73b68c57f3e2..d92cda7de437 100644 --- a/nixos/modules/virtualisation/oci-common.nix +++ b/nixos/modules/virtualisation/oci-common.nix @@ -30,17 +30,15 @@ in boot.growPartition = true; - fileSystems = lib.mkImageMediaOverride { - "/" = { - device = "/dev/disk/by-label/nixos"; - fsType = "ext4"; - autoResize = true; - }; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + autoResize = true; + }; - "/boot" = lib.mkIf cfg.efi { - device = "/dev/disk/by-label/ESP"; - fsType = "vfat"; - }; + fileSystems."/boot" = lib.mkIf cfg.efi { + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; }; boot.loader.efi.canTouchEfiVariables = false; diff --git a/nixos/modules/virtualisation/openstack-config.nix b/nixos/modules/virtualisation/openstack-config.nix index 34031c303039..caa3cbba6a6b 100644 --- a/nixos/modules/virtualisation/openstack-config.nix +++ b/nixos/modules/virtualisation/openstack-config.nix @@ -33,22 +33,18 @@ in ]; config = { - fileSystems."/" = mkIf (!cfg.zfs.enable) ( - lib.mkImageMediaOverride { - device = "/dev/disk/by-label/nixos"; - fsType = "ext4"; - autoResize = true; - } - ); + fileSystems."/" = mkIf (!cfg.zfs.enable) { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + autoResize = true; + }; - fileSystems."/boot" = mkIf (cfg.efi || cfg.zfs.enable) ( - lib.mkImageMediaOverride { - # The ZFS image uses a partition labeled ESP whether or not we're - # booting with EFI. - device = "/dev/disk/by-label/ESP"; - fsType = "vfat"; - } - ); + fileSystems."/boot" = mkIf (cfg.efi || cfg.zfs.enable) { + # The ZFS image uses a partition labeled ESP whether or not we're + # booting with EFI. + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; + }; boot.growPartition = true; boot.kernelParams = [ "console=tty1" ]; diff --git a/nixos/modules/virtualisation/openstack-options.nix b/nixos/modules/virtualisation/openstack-options.nix index 751e1612e833..9d1b1efd676d 100644 --- a/nixos/modules/virtualisation/openstack-options.nix +++ b/nixos/modules/virtualisation/openstack-options.nix @@ -70,14 +70,12 @@ in _: value: ((value.mount or null) != null) ) config.openstack.zfs.datasets; in - lib.mkImageMediaOverride ( - lib.mapAttrs' ( - dataset: opts: - lib.nameValuePair opts.mount { - device = dataset; - fsType = "zfs"; - } - ) mountable - ); + lib.mapAttrs' ( + dataset: opts: + lib.nameValuePair opts.mount { + device = dataset; + fsType = "zfs"; + } + ) mountable; }; } diff --git a/nixos/modules/virtualisation/proxmox-image.nix b/nixos/modules/virtualisation/proxmox-image.nix index 25aa3aee93c7..cb83a9e5ef29 100644 --- a/nixos/modules/virtualisation/proxmox-image.nix +++ b/nixos/modules/virtualisation/proxmox-image.nix @@ -306,13 +306,7 @@ with lib; '' ${vma}/bin/vma create "${config.image.baseName}.vma" \ -c ${ - cfgFile "qemu-server.conf" ( - (builtins.removeAttrs cfg.qemuConf [ "diskSize" ]) - // { - inherit (config.virtualisation) diskSize; - } - // cfg.qemuExtraConf - ) + cfgFile "qemu-server.conf" (cfg.qemuConf // cfg.qemuExtraConf) }/qemu-server.conf drive-virtio0=$diskImage rm $diskImage ${pkgs.zstd}/bin/zstd "${config.image.baseName}.vma" @@ -352,16 +346,14 @@ with lib; ]; }; - fileSystems = lib.mkImageMediaOverride { - "/" = { - device = "/dev/disk/by-label/nixos"; - autoResize = true; - fsType = "ext4"; - }; - "/boot" = lib.mkIf hasBootPartition { - device = "/dev/disk/by-label/ESP"; - fsType = "vfat"; - }; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + autoResize = true; + fsType = "ext4"; + }; + fileSystems."/boot" = lib.mkIf hasBootPartition { + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; }; networking = mkIf cfg.cloudInit.enable { diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix index 17dfa17cfbbb..26633731f647 100644 --- a/nixos/modules/virtualisation/virtualbox-image.nix +++ b/nixos/modules/virtualisation/virtualbox-image.nix @@ -275,7 +275,7 @@ in }; fileSystems = - lib.mkImageMediaOverride { + { "/" = { device = "/dev/disk/by-label/nixos"; autoResize = true; diff --git a/nixos/modules/virtualisation/vmware-image.nix b/nixos/modules/virtualisation/vmware-image.nix index f44c4b5bae07..6eebc6910ff0 100644 --- a/nixos/modules/virtualisation/vmware-image.nix +++ b/nixos/modules/virtualisation/vmware-image.nix @@ -83,17 +83,15 @@ in inherit config lib pkgs; }; - fileSystems = lib.mkImageMediaOverride { - "/" = { - device = "/dev/disk/by-label/nixos"; - autoResize = true; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + autoResize = true; + fsType = "ext4"; + }; - "/boot" = { - device = "/dev/disk/by-label/ESP"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; }; boot.growPartition = true;