Nixos-rebuild: Difference between revisions

Mightyiam (talk | contribs)
Correct position of references and categories
m Updated --use-remote-sudo flag to newer --sudo flag
 
Line 40: Line 40:
<code>--build-host</code> and <code>--target-host</code> can be used simultaneously, even with different hosts.
<code>--build-host</code> and <code>--target-host</code> can be used simultaneously, even with different hosts.


If you are rebuilding a remote host as a non-root user, use the <code>--use-remote-sudo</code> option to elevate on the remote machine during the rebuilding process:
If you are rebuilding a remote host as a non-root user, use the <code>--sudo</code> option to elevate on the remote machine during the rebuilding process:
<syntaxHighlight lang=console>
<syntaxhighlight lang="console">
$ nixos-rebuild --target-host user@example.com --use-remote-sudo switch
$ nixos-rebuild --target-host user@example.com --sudo switch
</syntaxHighlight>
</syntaxhighlight>


To enter a password while using remote sudo, prefix the command with <code>NIX_SSHOPTS="-o RequestTTY=force"</code>, or add <code>--ask-sudo-password</code> with <code>nixos-rebuild-ng</code>.
To enter a password while using remote sudo, prefix the command with <code>NIX_SSHOPTS="-o RequestTTY=force"</code>, or add <code>--ask-sudo-password</code> with <code>nixos-rebuild-ng</code>.