Skip to content

Conversation

@khaneliman
Copy link
Contributor

@khaneliman khaneliman commented Mar 18, 2025

Closes #233

Basically, with the new nix-darwin rewrite everything is moved to root activation. I check if the nix-darwin user activation script contains the deprecation notice. If it does, we just call the activate script only. (Where the old user activation stuff has been moved) Also, moved to using the darwin-rebuild script instead of the activation scripts directly so that nix-darwin can handle migrations themselves and we don't have to worry about the current implementation details every time a change is made upstream. We just elevate the activate when it needs to be.

Marking draft until the deprecation marker is solidified in nix-darwin/nix-darwin#1341

@khaneliman khaneliman force-pushed the darwin branch 2 times, most recently from 73633f8 to aee93d4 Compare March 18, 2025 18:15
@khaneliman khaneliman marked this pull request as draft March 18, 2025 18:19
@khaneliman
Copy link
Contributor Author

Currently calls activation scripts directly, sounds like we should be using the darwin-rebuild binary instead.

@khaneliman khaneliman force-pushed the darwin branch 3 times, most recently from bb7d429 to dc33934 Compare March 18, 2025 19:04
khaneliman added a commit to khaneliman/khanelinix that referenced this pull request Mar 18, 2025
Using nh fork with support for root activation until
nix-community/nh#238 is merged, using nix-darwin fork
with the plan p1 changes until that's merged.
@viperML
Copy link
Contributor

viperML commented Mar 26, 2025

Should we check whether the user has an older nix-darwin?

@khaneliman
Copy link
Contributor Author

Should we check whether the user has an older nix-darwin?

That’s what the deprecation check is for, we see if it’s missing from the activation script. If it is, it’s an older version

@khaneliman khaneliman marked this pull request as ready for review May 7, 2025 23:24
@khaneliman
Copy link
Contributor Author

Seems like this will be the way it works in nix-darwin/nix-darwin#1341 . I've been using this branch on my nixos desktop and macbook since I created the PR.

@NotAShelf
Copy link
Member

The diff looks good. Not large enough for me to nit either, so I think we can merge today.

Though I'm compelled to ask, is this a version specific thing? NH 4.0 has made it into nixpkgs, and changing it now might cause issues. Would that be the case, or can we merge this, release 4.1.0 and PR nixpkgs to provide the new change?

@khaneliman
Copy link
Contributor Author

The diff looks good. Not large enough for me to nit either, so I think we can merge today.

Though I'm compelled to ask, is this a version specific thing? NH 4.0 has made it into nixpkgs, and changing it now might cause issues. Would that be the case, or can we merge this, release 4.1.0 and PR nixpkgs to provide the new change?

It's backwards compatible with current nix-darwin. We check for the existence of the deprecation marker or a missing activate_user script before using the new method of elevated activation.

@NotAShelf
Copy link
Member

NotAShelf commented May 9, 2025

Just making sure. I haven't used Darwin at any point, and I would like to avoid merging broken behaviour.

In changes are backward compatible, I can merge this with the addition of a changelog entry in CHANGELOG.md.

khaneliman added 3 commits May 8, 2025 21:30
Nix-darwin is being rewritted to move to root activation and deprecating
the user activation script. Check whether the script we are activating
with contains the deprecation notice.
In the future the script will be removed, if it does get removed we
should just call the `activate` script as root.
Recommended to use the darwin-rebuild activate command by maintainers.
@khaneliman
Copy link
Contributor Author

Rebased and added changelog entries for changes.

@NotAShelf
Copy link
Member

Thank you, merging once the CI passes.

@NotAShelf NotAShelf merged commit 28972b6 into nix-community:master May 9, 2025
2 checks passed
@khaneliman khaneliman deleted the darwin branch May 9, 2025 02:39
@khaneliman
Copy link
Contributor Author

Thank you, merging once the CI passes.

Thanks raf, appreciate it

khaneliman added a commit to khaneliman/khanelinix that referenced this pull request May 9, 2025
Darwin root activation support merged into main in
nix-community/nh#238
khaneliman added a commit to khaneliman/khanelinix that referenced this pull request May 9, 2025
Darwin root activation support merged into main in
nix-community/nh#238
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

darwin: support new system activation

5 participants