Is GPT partition automounting possible? (such that /dev/disk/by-id/... is not necessary)

On arch linux, if the partitions are partitioned by GPT Partition type UUID [1] correctly, systemd-boot automatically discovers and mounts the partitions correctly [2].

This even works with luks-encrypted root partitions.

I never had to generate an /etc/fstab nor did I ever have to fiddle with /dev/disk/by-uuid/

I used truly the same system, could clone it to a new ssd’s root partition and plug and play. [3]

However, on nixos I have not found such an option. The hardware-configuration.nix embeds hardware-specific disk uuids, which is entirely unnecessary.

Is GPT partition automounting possible on nixOS?




BOOT_PART_NAME='Boot Partition'
ROOT_PART_NAME='Root Partition'

create_boot_partition() {
  sudo sgdisk \
    --new='0:0:+1GiB' \
    --change-name="0:${BOOT_PART_NAME}" \
    --typecode="0:${BOOT_PART_TYPE_GUID}" \

create_root_partition() {
  sudo sgdisk \
    --new='0:0:' \
    --change-name="0:${ROOT_PART_NAME}" \
    --typecode="0:${ROOT_PART_TYPE_GUID}" \

The full autodiscovery generator is not yet available for nixos.

You can do your [3], and reference the partitions in filesystems.* using /dev/disk/by-label paths. The installer has picked the disk paths via (probably) /dev/disk/by-id, in part because it’s very possible to have multiple disks/partitions with the same label, but you can of course edit that to fit your own practices and preference.

Thank you for the swift reply.
Using labels is a temporarily sufficient workaround.