Add existing disk configuration to disko configs #320
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It would be neat if we could use disko more. We can model the existing configurations in disko configs, and use the nixos modules that comes with it to have the disko config be the source of truth for
fileSystems(e.g. fstab and mount units).Already started by adding
hosts/kommode/disks.nixand removingfileSystemsfromhosts/kommode/hardware-configuration.nixWhy? We already have a nix source of truth for fileSystems, mainly in hardware-configuration.nix on all hosts, why complicate drive setup and add traps to an existing and working declarative setup?
Disko or something similar can make sense when installing new hosts, for example if we want to automatically provision/create VMs or something similar with little to no manual input. Does this issue add any value to existing hosts, except a cool tech demo / complication?
It makes the filesystem and disk-layout declarative and a property of the machine rather than, just "referred to" by filesystem uuids and mountpoints. It also lets us generate nixos-installers for a machine if we ever need to set it up from scratch
fileSystemswork, by all means. But adding config to disko would give us things like inherent disk config documentation (maybe even with comments and reasoning from whoever set it up), avoiding stuff like mounting/dev/sdajust because you happened to use that with themountcommand during install (disko tends to useby-partlabelby default). The inherent documentation thing also works for extended information in nix-topology and similar.It's not just cool tech demo, having extended information about how the disks are configured accessible from within the configuration is valuable for several other purposes.
Okay, I agree that using the hardware-config from
mount /dev/sda /mnt; nixos-generate-configblindly is bad, but that is an easy fix, either when installing or by updating the config later (We should do that on bekkalokk 😅, everything else looks to be /by-uuid/). Explanations/reasoning, disk layouts and special properties/settings are as usual already documented in the wiki for most hosts. That said, we haven't finished the discussion on if the wiki and/or nix-topology should be canonical/main docs, or if we will somehow be able to keep both maintained.Sure, for automatic (re-)installation of hosts, it can be practical, but I still think this will produce more accidents and confusion than benefits. Especially for new people, everyone probably already knows either how to use
partedor check the nixos manual, this looks like an unnecessary complication.Especially given the current state of our server environment, where reinstallations are rare, I am still opposed to diskofying current disk configurations in this issues. If/when we get some more automatic deployment/provisioning on PVE/OpenStack, disko can be a necessary tool on those type of hosts!