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

repair: add sequoia subcommand that can migrate build users to the new 351+ UID range #1143

Merged
merged 15 commits into from
Sep 12, 2024

Conversation

cole-h
Copy link
Member

@cole-h cole-h commented Sep 5, 2024

Description

Closes #1001.
Closes #1115.
Closes #1092.

Checklist
  • Formatted with cargo fmt
  • Built with nix build
  • Ran flake checks with nix flake check
  • Added or updated relevant tests (leave unchecked if not applicable)
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • Linked to related issues (leave unchecked if not applicable)
Validating with install.determinate.systems

If a maintainer has added the upload to s3 label to this PR, it will become available for installation via install.determinate.systems:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/pr/$PR_NUMBER | sh -s -- install

I still have some more testing to do, but so far I'm mostly satisfied with how it works. Feel free to take a look (at the code or at actually using it).

The default repair subcommand is still to repair the shell hooks (nix-installer repair == nix-installer repair hooks). To run the sequoia repair process, run nix-installer repair sequoia. If you're not on macOS 15 Sequoia yet, you'll want to pass the --move-existing-users flag (this was a compromise with the goal of making subsequent runs of the repair do nothing when all the users still exist because we already migrated them before).

@cole-h cole-h added the upload to s3 The labeled PR is allowed to upload its artifacts to S3 for easy testing label Sep 5, 2024
@cole-h cole-h changed the title WIP: repair: add sequoia subcommand that can migrate build users to the new 351+ UID range repair: add sequoia subcommand that can migrate build users to the new 351+ UID range Sep 10, 2024
@cole-h cole-h marked this pull request as ready for review September 10, 2024 20:42
@cole-h cole-h enabled auto-merge (squash) September 11, 2024 21:50
@grahamc
Copy link
Member

grahamc commented Sep 12, 2024

Just ran this before updating to Sequoia, worked perfectly!

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/pr/1143 | sh -s -- repair sequoia  --move-existing-users

@cole-h cole-h enabled auto-merge (squash) September 12, 2024 14:58
@cole-h cole-h merged commit ded6eb7 into main Sep 12, 2024
21 checks passed
@cole-h cole-h deleted the sequoia-repair branch September 12, 2024 15:09
);
// NOTE(cole-h): this round-trip is kinda jank... but Action is not
// object-safe, and I can't think of any other way to get the
// concrete `CreateUsersAndGroups` type out of a `Box<dyn Action>`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, from downstream review: https://doc.rust-lang.org/std/boxed/struct.Box.html#method.downcast-2

But this is not a big deal honestly, assuming that our roundtripping isn't busted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that, but couldn't get it to work 🤷

Maybe because it was originally a Box<dyn Action> and not CreateUsersAndGroups (i.e. it didn't go CreateUsersAndGroups -> Box<dyn Action>, but we parsed the receipt into a structure that only has Vec<Box<dyn Action>>, so it loses the original type information)?

If you can get it to work with that, I'd love to see the diff, because round-tripping isn't the most elegant... Maybe I overlooked something obvious!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you need an Any bound, but the way to actually make all this work is unnecessarily arcane (i don't remember if it works as a supertrait or if you have to do it a different way). I'll have to consult what i did in clipper with dyn stuff and have a go if i remember to get around to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upload to s3 The labeled PR is allowed to upload its artifacts to S3 for easy testing
Projects
None yet
3 participants