Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add _summary attribute as a human-readable description of Disko configs #952

Open
Zocker1999NET opened this issue Jan 27, 2025 · 1 comment

Comments

@Zocker1999NET
Copy link

Zocker1999NET commented Jan 27, 2025

For context: I am creating a NixOS installer UI, allowing the user to select which from all configurations a flake declares, to install on any computer. In some cases, those configurations differ in their disko configuration. So I would like to show a summary of a selected NixOS / disko configuration so users can differentiate the configurations provided in their or others flakes. But I think such a summary could be helpful to others as well.

What I was thinking was a new option, which is built recursively (comparable to the current _create option), but which provides a human-readable description of what will be installed on the disk. To give some examples based on disko’s examples:

  • simple-efi.nix:
    disks:
      "main" (/dev/disk/by-id/some-disk-id): GUID Partition Table
        500M "ESP": vfat filesystem for /boot
        100% "root": ext4 filesystem for /
    
  • swap.nix
    disks:
      "main" (/dev/vdb): GUID Partition Table
        500M "ESP": vfat filesystem for /boot
        ends -1G "root": ext4 filesystem for /
        10M "encryptedSwap": swap, encrypted, priority=100
        100% "plainSwap": swap, discardPolicy=both, resumeDevice
    
  • lvm-raid.nix
    disks:
      "one" (/dev/sda): GUID Partition Table
        500M "boot": assigned to mdraid "boot"
        100% "primary": LVM PV assigned to VG "pool"
      "two" (/dev/sdb): GUID Partition Table
        500M "boot": assigned to mdraid "boot"
        100% "primary": LVM PV assigned to VG "pool"
    mdadm:
      "boot", RAID 1, metadata 1.0: vfat filesystem for /boot
    LVM VGs:
      "pool":
        100M "root", mirror: ext4 filesystem for /
        10M "home", raid0: ext4 filesystem for /home
    

While coming up with my examples, I decided for the structure to be <container info>: <content info>, where content info can provide further lines for subcontainers. This structure can be discussed through. In general, I think important requirements on such a summary are:

  • be concise
    • avoid technical details while providing all important info
    • use less lines that the (formatted) Nix code
  • represent structural division and technologies used
    • how many disks are required? how many partitions are created?
    • how much storage will be made available to each partition/filesystem?
    • are LVM / mdadm / ZFS used (or possibly even combined)?
    • which filesystems are used for what mountpoints?

I created this issue because I think this could be helpful in other use cases (or installer realizations) as well, so I think something like that could be integrated into disko itself. And also because I currently have not enough experience with disko’s code base to built something like that myself (in the hope that someone else is faster than me).

@Mic92
Copy link
Member

Mic92 commented Jan 27, 2025

We are in fact also creating an installer UI for NixOS in https://git.clan.lol/clan/clan-core
However we are at the moment only using pre-defined templates where users just provide the device to install to, but we are interested what pattern you come up with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants