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

darwin -> darwin doesn't invoke user activation script #259

Open
hraban opened this issue Feb 15, 2024 · 2 comments
Open

darwin -> darwin doesn't invoke user activation script #259

hraban opened this issue Feb 15, 2024 · 2 comments

Comments

@hraban
Copy link

hraban commented Feb 15, 2024

nix-darwin has two activation scripts: regular activation (meant to run as root) and user activation. User activation is meant to run as a user with sudo permissions, for tools like brew which don't like being run as root but want to control their own privilege escalation.

When doing nix run github:serokell/deploy-rs -- --ssh-user user -s on a deployment similar to the darwin example, it runs the activation script, but not user activation.

Any idea how to get that invoked? Am I doing something wrong in calling the deploy script?

@rvem
Copy link
Member

rvem commented Feb 16, 2024

Hmm, I don't think that it's currently possible for a single profile to run activation scripts under multiple users.

Do you have an example of such a configuration that needs to be activated under both root and user?

As a workaround, I think it might be possible to split your configuration into two profiles: one under root and the other under your regular user

@hraban
Copy link
Author

hraban commented Feb 18, 2024

It's the standard MO of nix-darwin afaik. The "result" of a nix-darwin build creates two separate activation scripts, and nix-darwin switch calls them both separately. There's an entrypoint in the nix-darwin codebase which calls both those scripts. You can't just call them directly from the resulting derivation's output dir, afaik.

https://github.com/LnL7/nix-darwin/blob/0e6857fa1d632637488666c08e7b02c08e3178f8/pkgs/nix-tools/darwin-rebuild.sh#L222-L230 seems to be where it happens.

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

No branches or pull requests

2 participants