lol

Use mkImageMediaOverride for filesystem attributes of various images (#397330)

authored by

jopejoe1 and committed by
GitHub
326702f8 ab829c99

+81 -63
+1 -1
nixos/modules/installer/sd-card/sd-image.nix
··· 185 185 config = { 186 186 hardware.enableAllHardware = true; 187 187 188 - fileSystems = { 188 + fileSystems = lib.mkImageMediaOverride { 189 189 "/boot/firmware" = { 190 190 device = "/dev/disk/by-label/${config.sdImage.firmwarePartitionName}"; 191 191 fsType = "vfat";
+1 -1
nixos/modules/virtualisation/azure-image.nix
··· 113 113 ''; 114 114 }; 115 115 116 - fileSystems = { 116 + fileSystems = lib.mkImageMediaOverride { 117 117 "/" = { 118 118 device = "/dev/disk/by-label/${cfg.label}"; 119 119 inherit (cfg) label;
+1 -1
nixos/modules/virtualisation/digital-ocean-config.nix
··· 39 39 in 40 40 mkMerge [ 41 41 { 42 - fileSystems."/" = lib.mkDefault { 42 + fileSystems."/" = lib.mkImageMediaOverride { 43 43 device = "/dev/disk/by-label/nixos"; 44 44 autoResize = true; 45 45 fsType = "ext4";
+1 -1
nixos/modules/virtualisation/disk-image.nix
··· 37 37 boot.loader.systemd-boot.enable = lib.mkDefault cfg.efiSupport; 38 38 boot.growPartition = lib.mkDefault true; 39 39 40 - fileSystems = { 40 + fileSystems = lib.mkImageMediaOverride { 41 41 "/" = { 42 42 device = "/dev/disk/by-label/nixos"; 43 43 autoResize = true;
+1 -1
nixos/modules/virtualisation/google-compute-config.nix
··· 21 21 ../profiles/qemu-guest.nix 22 22 ]; 23 23 24 - fileSystems."/" = { 24 + fileSystems."/" = lib.mkImageMediaOverride { 25 25 fsType = "ext4"; 26 26 device = "/dev/disk/by-label/nixos"; 27 27 autoResize = true;
+10 -8
nixos/modules/virtualisation/hyperv-image.nix
··· 73 73 inherit config lib pkgs; 74 74 }; 75 75 76 - fileSystems."/" = { 77 - device = "/dev/disk/by-label/nixos"; 78 - autoResize = true; 79 - fsType = "ext4"; 80 - }; 76 + fileSystems = lib.mkImageMediaOverride { 77 + "/" = { 78 + device = "/dev/disk/by-label/nixos"; 79 + autoResize = true; 80 + fsType = "ext4"; 81 + }; 81 82 82 - fileSystems."/boot" = { 83 - device = "/dev/disk/by-label/ESP"; 84 - fsType = "vfat"; 83 + "/boot" = { 84 + device = "/dev/disk/by-label/ESP"; 85 + fsType = "vfat"; 86 + }; 85 87 }; 86 88 87 89 boot.growPartition = true;
+1 -1
nixos/modules/virtualisation/kubevirt.nix
··· 12 12 ]; 13 13 14 14 config = { 15 - fileSystems."/" = { 15 + fileSystems."/" = lib.mkImageMediaOverride { 16 16 device = "/dev/disk/by-label/nixos"; 17 17 fsType = "ext4"; 18 18 autoResize = true;
+3 -5
nixos/modules/virtualisation/linode-config.nix
··· 1 1 { 2 - config, 3 2 lib, 4 3 pkgs, 5 4 ... 6 5 }: 7 - with lib; 8 6 { 9 7 imports = [ ../profiles/qemu-guest.nix ]; 10 8 ··· 12 10 enable = true; 13 11 14 12 settings.PermitRootLogin = "prohibit-password"; 15 - settings.PasswordAuthentication = mkDefault false; 13 + settings.PasswordAuthentication = lib.mkDefault false; 16 14 }; 17 15 18 16 networking = { ··· 34 32 sysstat 35 33 ]; 36 34 37 - fileSystems."/" = { 35 + fileSystems."/" = lib.mkImageMediaOverride { 38 36 fsType = "ext4"; 39 37 device = "/dev/sda"; 40 38 autoResize = true; 41 39 }; 42 40 43 - swapDevices = mkDefault [ { device = "/dev/sdb"; } ]; 41 + swapDevices = lib.mkDefault [ { device = "/dev/sdb"; } ]; 44 42 45 43 # Enable LISH and Linode Booting w/ GRUB 46 44 boot = {
+10 -8
nixos/modules/virtualisation/oci-common.nix
··· 30 30 31 31 boot.growPartition = true; 32 32 33 - fileSystems."/" = { 34 - device = "/dev/disk/by-label/nixos"; 35 - fsType = "ext4"; 36 - autoResize = true; 37 - }; 33 + fileSystems = lib.mkImageMediaOverride { 34 + "/" = { 35 + device = "/dev/disk/by-label/nixos"; 36 + fsType = "ext4"; 37 + autoResize = true; 38 + }; 38 39 39 - fileSystems."/boot" = lib.mkIf cfg.efi { 40 - device = "/dev/disk/by-label/ESP"; 41 - fsType = "vfat"; 40 + "/boot" = lib.mkIf cfg.efi { 41 + device = "/dev/disk/by-label/ESP"; 42 + fsType = "vfat"; 43 + }; 42 44 }; 43 45 44 46 boot.loader.efi.canTouchEfiVariables = false;
+15 -11
nixos/modules/virtualisation/openstack-config.nix
··· 33 33 ]; 34 34 35 35 config = { 36 - fileSystems."/" = mkIf (!cfg.zfs.enable) { 37 - device = "/dev/disk/by-label/nixos"; 38 - fsType = "ext4"; 39 - autoResize = true; 40 - }; 36 + fileSystems."/" = mkIf (!cfg.zfs.enable) ( 37 + lib.mkImageMediaOverride { 38 + device = "/dev/disk/by-label/nixos"; 39 + fsType = "ext4"; 40 + autoResize = true; 41 + } 42 + ); 41 43 42 - fileSystems."/boot" = mkIf (cfg.efi || cfg.zfs.enable) { 43 - # The ZFS image uses a partition labeled ESP whether or not we're 44 - # booting with EFI. 45 - device = "/dev/disk/by-label/ESP"; 46 - fsType = "vfat"; 47 - }; 44 + fileSystems."/boot" = mkIf (cfg.efi || cfg.zfs.enable) ( 45 + lib.mkImageMediaOverride { 46 + # The ZFS image uses a partition labeled ESP whether or not we're 47 + # booting with EFI. 48 + device = "/dev/disk/by-label/ESP"; 49 + fsType = "vfat"; 50 + } 51 + ); 48 52 49 53 boot.growPartition = true; 50 54 boot.kernelParams = [ "console=tty1" ];
+9 -7
nixos/modules/virtualisation/openstack-options.nix
··· 70 70 _: value: ((value.mount or null) != null) 71 71 ) config.openstack.zfs.datasets; 72 72 in 73 - lib.mapAttrs' ( 74 - dataset: opts: 75 - lib.nameValuePair opts.mount { 76 - device = dataset; 77 - fsType = "zfs"; 78 - } 79 - ) mountable; 73 + lib.mkImageMediaOverride ( 74 + lib.mapAttrs' ( 75 + dataset: opts: 76 + lib.nameValuePair opts.mount { 77 + device = dataset; 78 + fsType = "zfs"; 79 + } 80 + ) mountable 81 + ); 80 82 }; 81 83 }
+17 -9
nixos/modules/virtualisation/proxmox-image.nix
··· 306 306 '' 307 307 ${vma}/bin/vma create "${config.image.baseName}.vma" \ 308 308 -c ${ 309 - cfgFile "qemu-server.conf" (cfg.qemuConf // cfg.qemuExtraConf) 309 + cfgFile "qemu-server.conf" ( 310 + (builtins.removeAttrs cfg.qemuConf [ "diskSize" ]) 311 + // { 312 + inherit (config.virtualisation) diskSize; 313 + } 314 + // cfg.qemuExtraConf 315 + ) 310 316 }/qemu-server.conf drive-virtio0=$diskImage 311 317 rm $diskImage 312 318 ${pkgs.zstd}/bin/zstd "${config.image.baseName}.vma" ··· 346 352 ]; 347 353 }; 348 354 349 - fileSystems."/" = { 350 - device = "/dev/disk/by-label/nixos"; 351 - autoResize = true; 352 - fsType = "ext4"; 353 - }; 354 - fileSystems."/boot" = lib.mkIf hasBootPartition { 355 - device = "/dev/disk/by-label/ESP"; 356 - fsType = "vfat"; 355 + fileSystems = lib.mkImageMediaOverride { 356 + "/" = { 357 + device = "/dev/disk/by-label/nixos"; 358 + autoResize = true; 359 + fsType = "ext4"; 360 + }; 361 + "/boot" = lib.mkIf hasBootPartition { 362 + device = "/dev/disk/by-label/ESP"; 363 + fsType = "vfat"; 364 + }; 357 365 }; 358 366 359 367 networking = mkIf cfg.cloudInit.enable {
+1 -1
nixos/modules/virtualisation/virtualbox-image.nix
··· 275 275 }; 276 276 277 277 fileSystems = 278 - { 278 + lib.mkImageMediaOverride { 279 279 "/" = { 280 280 device = "/dev/disk/by-label/nixos"; 281 281 autoResize = true;
+10 -8
nixos/modules/virtualisation/vmware-image.nix
··· 83 83 inherit config lib pkgs; 84 84 }; 85 85 86 - fileSystems."/" = { 87 - device = "/dev/disk/by-label/nixos"; 88 - autoResize = true; 89 - fsType = "ext4"; 90 - }; 86 + fileSystems = lib.mkImageMediaOverride { 87 + "/" = { 88 + device = "/dev/disk/by-label/nixos"; 89 + autoResize = true; 90 + fsType = "ext4"; 91 + }; 91 92 92 - fileSystems."/boot" = { 93 - device = "/dev/disk/by-label/ESP"; 94 - fsType = "vfat"; 93 + "/boot" = { 94 + device = "/dev/disk/by-label/ESP"; 95 + fsType = "vfat"; 96 + }; 95 97 }; 96 98 97 99 boot.growPartition = true;