-
-
Notifications
You must be signed in to change notification settings - Fork 212
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 configration option for partition UUIDs #951
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the good work. I agree, such an option would be quite valuable 👍
The disko devs might ask for tests as well ^^
@@ -74,6 +79,16 @@ in | |||
description = "Name of the partition"; | |||
default = name; | |||
}; | |||
uuid = lib.mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call the option guid
so it's harder to mistake for the filesystem's id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I called it uuid
because, within the Linux context, it's always referred as that. For example, the name of /dev/disk/by-partuuid
, blkid
calls it PARTUUID
etc. I could have named it partuuid
, but I figured that if there is ever a separate filesystem UUID option, that would be distinguished as partition.content.uuid
vs partition.uuid
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that works.
default = null; | ||
example = "809b3a2b-828a-4730-95e1-75b6343e415a"; | ||
description = '' | ||
The UUID (also known as GUID) of the partition. Note that this is distinct from the UUID of the filesystem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document which types of partition table support the option. Maybe also add a corresponding assertion to the module, to give a clear error rather than unexpected behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does disko support anything other than GPT? At least, I included it in the gpt.nix
module assuming that it would only be available for GPT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently we still support DOS with the legacy table, but that is deprecated and it's fine to do it here for gpt only
args = '' | ||
--partition-guid="${toString partition._index}:${if partition.uuid == null then "R" else partition.uuid}" \ | ||
--change-name="${toString partition._index}:${partition.label}" \ | ||
--typecode=${toString partition._index}:${partition.type} \ | ||
"${config.device}" \ | ||
''; | ||
createArgs = '' | ||
--align-end ${lib.optionalString (partition.alignment != 0) ''--set-alignment=${builtins.toString partition.alignment}''} \ | ||
--new=${toString partition._index}:${partition.start}:${partition.end} \ | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why this was split, but isn' the device more of a createArg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to avoid repeating itself, nothing more. It seemed nicer this way. I can revert it to the original style if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback addressed
Closes #948. This is my first ever Nix-related PR, so I'd appreciate feedback if you have any!
I wasn't sure if mdadm does expose
partuuid
, I assumed that it did but that may be wrong. I did run the tests, but I wasn't sure if it was wise to include UUIDs in example files. It's probably not a good idea for users to copy the UUID, they should generate their own.