Is there a way to specify UUIDs for partitions in diskio? Doing so would help me not update my ${hostname}-hardware-configuration.nix
file everytime I need to clean-install on a host with same storage layout.
/dev/disk/by-{id,path}
?
cf. https://github.com/nix-community/disko/issues/14
Not the target disk... specifying the UUIDs of the partitions created themselves.
Isn't diskio responsible for creating those partitions? I haven't used it but it was my impression that was the point of the tool.
You can get the same storage layout without necessarily fixing individual partition's UUID. See for example https://github.com/srid/nixos-config/blob/master/nixos/disko/trivial.nix
This layout remains the same across re-installs (wherein the partition UUID will change)
Or maybe I'm not understanding your question, @Pratham Patel
If you use disko, you will not have to manually specify the UUID in hardware-configuration.nix
, because disko manages it for you, if i am not wrong. I never had to do that at least.
@Srid This question came out of my migration to deploying nixos on my machines using flakes. Flakes mandate that all files be included in the git tree and therefore, it's not possible to have the hardware-configuration.nix
in the repo in advance. Specifying the UUIDs for each partition/filesystem in diskio would be nice for this, where the hardware-configuration.nix
file already picks up the devices using the /dev/disk/by-uuid
path. :)
So you want to introduce disko on an already-installed NixOS machine?
This looks to be the same problem as https://github.com/juspay/remote-development/issues/11
This may be relevant: https://github.com/nix-community/disko/issues/295
Sort of, yes! :)
Finally got some free time to poke around in the disko src and noticed this line: https://github.com/nix-community/disko/blob/f6b72bfed7c57997aa5dccd94a3ebbc4cb824b04/lib/types/filesystem.nix#L48
So, the pseudo code would be something like:
-U
or -u
option to specify the UUID to assign to, such that, it appears as /dev/disk/by-uuid/${UUID}
.-U ${UUID}
if some option, let's assume customUUID
is specified.That way, the same disko config _and_ same hardware-configuration.nix
can be used, even when the disk is reformatted, preserving the UUID, resulting in not needing to update the hardware-configuration.nix
file, at all
@Pratham Patel Is this relevant? https://github.com/nix-community/disko/pull/548#issuecomment-1967664266
huh, this is better than what I was looking for! thank you :D
Last updated: Nov 15 2024 at 12:33 UTC