-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
darwin.rs: handle new root only activation #238
base: master
Are you sure you want to change the base?
Conversation
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.
Currently calls activation scripts directly, sounds like we should be using the |
cdc466c
to
bb7d429
Compare
Recommended to use the darwin-rebuild activate command by maintainers.
Using nh fork with support for root activation until viperML/nh#238 is merged, using nix-darwin fork with the plan p1 changes until that's merged.
|
||
Command::new(switch_to_configuration) | ||
.elevate(true) | ||
let darwin_rebuild = out_path.get_path().join("sw/bin/darwin-rebuild"); |
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.
this introduces a dependency on darwin-rebuild
which is not always present.
If you can’t or don’t want to use
darwin-rebuild activate
, then you
should skip runningactivate-user
for post‐user‐activation
configurations and continue runningactivate
asroot
.
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.
In what situation is it not present? This is the darwin-rebuild
from the built configuration.
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.
This change was done from conversations with emilazy on matrix recommending i switch the implementation from using the activation scripts directly to the built darwin-rebuild
binary.
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.
In what situation is it not present? This is the
darwin-rebuild
from the built configuration.
system.tools.darwin-rebuild.enable = false
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.
You shouldn’t set system.tools.darwin-rebuild.enable
on a system you want to switch configurations on. We should probably add a stronger warning to that option and maybe hide it, since it’s extremely niche. In the long run we will hopefully have separate apply
/switch-to-configuration
scripts, but currently I don’t think this is a configuration activation tools should worry about supporting.
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 thedarwin-rebuild
script instead of the activation scripts directly so thatnix-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 theactivate
when it needs to be.Marking draft until the deprecation marker is solidified in LnL7/nix-darwin#1341