Consider using disko or some alternative for disk management

One of the weak points of NixOS is it’s disk management, as it has none by default, you cant format your disks from a nix file. Having Disko be a core part of the ecossystem would be nice to make 1. installation easier, 2. disk management way easier, by just declaring the filesystem layout in something like disks.nix file, without needing to mess around with the weird “fileSystems” options.

In my opinion it would be nice to integrate it by:

  • Having either actual disko imported by default by the Aux configurations or have an Aux replacement for disko
  • Having a CLI called something like auxolotl-generate-config that would generate system-configuration.nix, default.nix (for importing them on a flake or something), hardware.nix (for hardware stuff like CPU microcodes n whatever) and disks.nix (which would be the disko configuration).

From that there could be other integrations or something! What do you guys think?

11 Likes

i personally use disko, it’s amazing and i’d recommend it

1 Like

+1 for disko, it made installing machine soo much nicer! Not only the partitioning but also their mounting during installation resolves a whole bunch of manual installation steps.

I guesstimate that partitioning can end up being something very “personal” as in connected to the setup one wants to implement, hence there IMO should either be a “load this disko config” button or an escape hatch to manual partitioning.

That said, what if the installer would contain a set of “vetted” or recommended partitioning schemes for different filesystems to choose from?
E.g. one for ZFS, butterfs, ext4 - maybe an additional flag for dualboot systems or hibernation support :thinking:

4 Likes

I haven’t used disko yet as I hadn’t heard of it before installing NixOS and to my knowledge it’s not possible to add it to an existing install, but it seems a good idea for maximum reproducibility.

I’m a very happy disko user in a root-on-tmpfs and I can vouch for it.

Quick question: does this end up in /etc/nixos/hardware-configuration.nix and if so, is there protection from somehow formatting your drive from a simple nixos-rebuild switch?

3 Likes

disko generally requires running a separate command (the one I run when I format my disks from a live environment is nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko <disko-conf-path>) and it’s extremely impure in evaluation and in its results, so i doubt it’ll be a part of the standard nixos-rebuild pipeline.

2 Likes

Oh that’s awesome! Thank you for making this post so I look it up, I’d never heard of disko before.

1 Like

My only concern is that the auxolotl implementation of disko might introduce breaking changes, requiring me to rewrite my disko module that I use across all machines, potentially requiring reinstallation on all of them. I think it’s acceptable for new disko users to require a reinstallation, but existing disko users probably wouldn’t want that.

maybe we should integrate it into nixos-install if we end up integrating it at all? like nixos-install --format-disks. it could make it into a sort of all-in-one tool.

2 Likes

This reminded me that, integrating a user-friendly nixos-anywhere wrapper with disko, along with some features like declarative extra file generation support (e.g., LUKS SSH key), into something like auxos-install would be great. I had to make a nixos-anywhere wrapper in bash because no way I’m going to bother remembering all the necessary commands and flags.

2 Likes