Commit 887f7d33 authored by phaer's avatar phaer
Browse files

virtualisation/openstack: use mkImageMediaOverride...

...for filesystem options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant openstack-zfs --flake .#my-host`
parent 6f83796a
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -33,18 +33,22 @@ in
  ];

  config = {
    fileSystems."/" = mkIf (!cfg.zfs.enable) {
    fileSystems."/" = mkIf (!cfg.zfs.enable) (
      lib.mkImageMediaOverride {
        device = "/dev/disk/by-label/nixos";
        fsType = "ext4";
        autoResize = true;
    };
      }
    );

    fileSystems."/boot" = mkIf (cfg.efi || cfg.zfs.enable) {
    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";
    };
      }
    );

    boot.growPartition = true;
    boot.kernelParams = [ "console=tty1" ];
+9 −7
Original line number Diff line number Diff line
@@ -70,12 +70,14 @@ 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;
        ) mountable
      );
  };
}