Skip to content

Commit

Permalink
darwin.builder: auto-login as the builder user (#208772)
Browse files Browse the repository at this point in the history
… as suggested by @NiklasGollenstede in:

#206951 (comment)

This simplifies the user experience for logging into and
debugging the machine and also simplifies the instructions for
shutting down the machine gracefully.
  • Loading branch information
Gabriella439 authored Jan 4, 2023
1 parent d067c8a commit 6d89aa8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 7 additions & 5 deletions doc/builders/special/darwin-builder.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ Password:
```

… so that it can install a private key used to `ssh` into the build server.
After that the script will launch the virtual machine:
After that the script will launch the virtual machine and automatically log you
in as the `builder` user:

```
<<< Welcome to NixOS 22.11.20220901.1bd8d11 (aarch64) - ttyAMA0 >>>
Run 'nixos-help' for the NixOS manual.
nixos login:
nixos login: builder (automatic login)
[builder@nixos:~]$
```

> Note: When you need to stop the VM, type `Ctrl`-`a` + `c` to open the `qemu`
> prompt and then type `system_powerdown` followed by `Enter`, or run `shutdown now`
> as the `builder` user (e.g. `ssh -i keys/builder_ed25519 builder@localhost shutdown now`)
> Note: When you need to stop the VM, run `shutdown now` as the `builder` user.
To delegate builds to the remote builder, add the following options to your
`nix.conf` file:
Expand Down
10 changes: 7 additions & 3 deletions nixos/modules/profiles/macos-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ in
trusted-users = [ "root" user ];
};

services.openssh = {
enable = true;
services = {
getty.autologinUser = user;

authorizedKeysFiles = [ "${keysDirectory}/%u_${keyType}.pub" ];
openssh = {
enable = true;

authorizedKeysFiles = [ "${keysDirectory}/%u_${keyType}.pub" ];
};
};

system.build.macos-builder-installer =
Expand Down

0 comments on commit 6d89aa8

Please sign in to comment.