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`
This commit is contained in:
phaer 2025-04-11 11:54:19 +02:00
parent 6f83796aa5
commit 887f7d33e0
2 changed files with 24 additions and 18 deletions

View file

@ -33,18 +33,22 @@ in
];
config = {
fileSystems."/" = mkIf (!cfg.zfs.enable) {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
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) {
# 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) (
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" ];

View file

@ -70,12 +70,14 @@ in
_: value: ((value.mount or null) != null)
) config.openstack.zfs.datasets;
in
lib.mapAttrs' (
dataset: opts:
lib.nameValuePair opts.mount {
device = dataset;
fsType = "zfs";
}
) mountable;
lib.mkImageMediaOverride (
lib.mapAttrs' (
dataset: opts:
lib.nameValuePair opts.mount {
device = dataset;
fsType = "zfs";
}
) mountable
);
};
}