deploy-rs icon indicating copy to clipboard operation
deploy-rs copied to clipboard

darwin -> darwin doesn't invoke user activation script

Open hraban opened this issue 1 year ago • 2 comments

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?

hraban avatar Feb 15 '24 05:02 hraban

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

rvem avatar Feb 16 '24 08:02 rvem

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.

hraban avatar Feb 18 '24 16:02 hraban