diff options
| author | Maxim Cournoyer <maxim@guixotic.coop> | 2026-05-10 17:03:31 +0900 |
|---|---|---|
| committer | Maxim Cournoyer <maxim@guixotic.coop> | 2026-05-23 13:21:16 +0900 |
| commit | 6e7d100ee39bdfdb2ad350633c34bcd2dc4ca73a (patch) | |
| tree | 44ec92f082e8394862ac76d4fc6d42ead78b0467 /gnu/machine | |
| parent | 77308a4eb566b42e1306db1e43f452744bb97191 (diff) | |
machine: hetzner: Allow providing the SSH user.
* gnu/machine/hetzner.scm (<hetzner-configuration>)
[user]: New field.
(hetzner-machine-delegate): Use match-record to bind the field values; honor
user.
* doc/guix.texi (Invoking guix deploy): Document it.
Fixes: #8493
Change-Id: I026828c508ea936523fe864e2646ab9e3a1329c4
Diffstat (limited to 'gnu/machine')
| -rw-r--r-- | gnu/machine/hetzner.scm | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/gnu/machine/hetzner.scm b/gnu/machine/hetzner.scm index 07e62d24e33..b6a13ac8466 100644 --- a/gnu/machine/hetzner.scm +++ b/gnu/machine/hetzner.scm | |||
| @@ -85,6 +85,7 @@ | |||
| 85 | hetzner-configuration-server-type | 85 | hetzner-configuration-server-type |
| 86 | hetzner-configuration-ssh-key | 86 | hetzner-configuration-ssh-key |
| 87 | hetzner-configuration-ssh-public-key | 87 | hetzner-configuration-ssh-public-key |
| 88 | hetzner-configuration-user | ||
| 88 | hetzner-configuration? | 89 | hetzner-configuration? |
| 89 | hetzner-environment-type)) | 90 | hetzner-environment-type)) |
| 90 | 91 | ||
| @@ -268,7 +269,9 @@ Have you run 'guix archive --generate-key'?") | |||
| 268 | (lambda (value) | 269 | (lambda (value) |
| 269 | (if (string? value) (public-key-from-file value) value)))) | 270 | (if (string? value) (public-key-from-file value) value)))) |
| 270 | (ssh-key hetzner-configuration-ssh-key | 271 | (ssh-key hetzner-configuration-ssh-key |
| 271 | (default #f))) ; #f | string | 272 | (default #f)) ; #f | string |
| 273 | (user hetzner-configuration-user | ||
| 274 | (default "root"))) ;string | ||
| 272 | 275 | ||
| 273 | (define (hetzner-configuration-ssh-key-fingerprint config) | 276 | (define (hetzner-configuration-ssh-key-fingerprint config) |
| 274 | "Return the SSH public key fingerprint of CONFIG as a string." | 277 | "Return the SSH public key fingerprint of CONFIG as a string." |
| @@ -293,21 +296,26 @@ Have you run 'guix archive --generate-key'?") | |||
| 293 | ;; Get the operating system WITHOUT the provenance service to avoid a | 296 | ;; Get the operating system WITHOUT the provenance service to avoid a |
| 294 | ;; duplicate symlink conflict in the store. | 297 | ;; duplicate symlink conflict in the store. |
| 295 | (os ((@@ (gnu machine) %machine-operating-system) target))) | 298 | (os ((@@ (gnu machine) %machine-operating-system) target))) |
| 296 | (machine | 299 | (match-record config <hetzner-configuration> |
| 297 | (inherit target) | 300 | ( authorize? allow-downgrades? build-locally? user) |
| 298 | (operating-system | 301 | (machine |
| 299 | (if (hetzner-configuration-authorize? config) | 302 | (inherit target) |
| 300 | (operating-system-authorize os) | 303 | (operating-system |
| 301 | os)) | 304 | (if authorize? |
| 302 | (environment managed-host-environment-type) | 305 | (operating-system-authorize os) |
| 303 | (configuration | 306 | os)) |
| 304 | (machine-ssh-configuration | 307 | (environment managed-host-environment-type) |
| 305 | (allow-downgrades? (hetzner-configuration-allow-downgrades? config)) | 308 | (configuration |
| 306 | (authorize? (hetzner-configuration-authorize? config)) | 309 | (machine-ssh-configuration |
| 307 | (build-locally? (hetzner-configuration-build-locally? config)) | 310 | (allow-downgrades? allow-downgrades?) |
| 308 | (host-name (hetzner-server-public-ipv4 server)) | 311 | (authorize? authorize?) |
| 309 | (identity (hetzner-configuration-ssh-key config)) | 312 | (build-locally? build-locally?) |
| 310 | (system (hetzner-server-system server))))))) | 313 | (host-name (hetzner-server-public-ipv4 server)) |
| 314 | ;; XXX: match-record doesn't make use of custom accessors to obtain | ||
| 315 | ;; the value, so we can't bind SSH-KEY with it. | ||
| 316 | (identity (hetzner-configuration-ssh-key config)) | ||
| 317 | (system (hetzner-server-system server)) | ||
| 318 | (user user))))))) | ||
| 311 | 319 | ||
| 312 | (define (hetzner-machine-location machine) | 320 | (define (hetzner-machine-location machine) |
| 313 | "Find the location of MACHINE on the Hetzner API." | 321 | "Find the location of MACHINE on the Hetzner API." |
