Best practice to avoid repetition with disko disk setup?

Hey,

I’m setting up a Hetzner auction server with 15 HDD disks. The disks run from /dev/sda/dev/sdo.

I would want to setup all of the disks in the same way so that each of them have boot partitions and then rest of the disk is dedicated to zfs.

I already did the setup I wanted for another example server here which only had /dev/nvme0 and /dev/nvme1 here: hetzner-auction-nixos-example/disko-zfs.nix at a7a705f5c15ba322fdc28f5b0208bb23b4e6d236 · onnimonni/hetzner-auction-nixos-example · GitHub

This gets pretty repetitive and hard to maintain if I will do this exact same thing for 15 disks :thinking:.

I haven’t yet figured out how to create loops in nix but I imagine something like that would be helpful.

How would you setup all of these disks in idiomatic nix?

I did find this example using GitHub code search:

Is this a typical way to setup multiple disks?

I used a similiar approach as they did here:

The only gotcha from this change is that I needed to move all existing directives inside a config block. The error message was not crystal clear for me immediately but I understood it in the end:

Module `/nix/store/8jjr89m94k72vip7fnl52a6sb90wbjc5-source/disko-zfs.nix' has an unsupported attribute `boot'. This is caused by introducing a top-level `config' or `options' attribute. Add configuration attributes immediately on the top level instead, or move all of them (namely: boot disko) into the explicit `config' attribute.