pub-solar-os/doc/integrations/deploy.md

50 lines
1.1 KiB
Markdown
Raw Normal View History

2021-02-15 18:08:17 +00:00
# deploy-rs
[Deploy-rs][d-rs] is a tool for managing NixOS remote machines. It was
2021-02-18 01:31:33 +00:00
chosen for devos after the author experienced some frustrations with the
2021-02-15 18:08:17 +00:00
stateful nature of nixops' db. It was also designed from scratch to support
flake based deployments, and so is an excellent tool for the job.
2021-04-19 02:26:27 +00:00
By default, all the [hosts](../concepts/hosts.md) are also available as deploy-rs nodes,
2021-02-15 18:08:17 +00:00
configured with the hostname set to `networking.hostName`; overridable via
the command line.
## Usage
Just add your ssh key to the host:
```nix
{ ... }:
{
users.users.${sshUser}.openssh.authorizedKeys.keyFiles = [
../secrets/path/to/key.pub
];
}
```
And the private key to your user:
```nix
{ ... }:
{
home-manager.users.${sshUser}.programs.ssh = {
enable = true;
matchBlocks = {
${host} = {
host = hostName;
identityFile = ../secrets/path/to/key;
extraOptions = { AddKeysToAgent = "yes"; };
};
};
}
}
```
And run the deployment:
```sh
deploy '.#hostName' --hostname host.example.com
2021-02-15 18:08:17 +00:00
```
> ##### _Note:_
> Your user will need **passwordless** sudo access
2021-02-15 18:08:17 +00:00
[d-rs]: https://github.com/serokell/deploy-rs