From patchwork Thu Mar 13 10:07:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Trofimov X-Patchwork-Id: 40135 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CE7AF27BBE9; Thu, 13 Mar 2025 10:09:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED,URIBL_SBL_A autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7C97127BBE2 for ; Thu, 13 Mar 2025 10:09:12 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tsfUu-0006ca-Lm; Thu, 13 Mar 2025 06:09:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tsfUs-0006aP-FW for guix-patches@gnu.org; Thu, 13 Mar 2025 06:09:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tsfUs-0000gh-5y for guix-patches@gnu.org; Thu, 13 Mar 2025 06:09:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=0VCqU8vBEXRl6Fkhx7eG57peNvRnPY45aSRE6U71mV0=; b=s6dpjPG5iY9vtMdSn6JIql67JC+kU+lWUU2JbFNYcU4tQ42TxDmFNpxG+SusPlzMlvtxheUgqsyoxFxrDeNBMyHu3xWhrVzYMKnscj89JqLwCIbfuGlKNjIPvEGAmFhkt3HOkTb3hxnYCfp3RH9IT8Us6DzZ0Z3A+IB+ATRFoHK0bKAfGy1NgO42DyNyQj/VysQ5gtRtEsj6Xj75mOToNOOYdua3+QwNGD+l6PcHkGoPNW122H6P9adtSh4OXzUBiwfdgCdlQ+8zL6Q58M4jVdnQNpHt1gM3Fdn8dM2ZDpMT1KEso/bBFD3J19vBuHsKdYWXApmogCiIi8yrrOFTgg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tsfUr-00041R-N8 for guix-patches@gnu.org; Thu, 13 Mar 2025 06:09:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#75144] [PATCH] machine: Implement 'hetzner-environment-type'. References: <6ff52cb81582c81835e39beebc7e6f7f3ecfd81d.1735317980.git.roman@burningswell.com> In-Reply-To: <6ff52cb81582c81835e39beebc7e6f7f3ecfd81d.1735317980.git.roman@burningswell.com> Resent-From: Sergey Trofimov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 13 Mar 2025 10:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75144 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Roman Scherer Cc: Josselin Poiret , Maxim Cournoyer , Simon Tournier , Mathieu Othacehe , Ludovic Court?s , Tobias Geerinckx-Rice , Christopher Baines , 75144@debbugs.gnu.org Received: via spool by 75144-submit@debbugs.gnu.org id=B75144.174186048615384 (code B ref 75144); Thu, 13 Mar 2025 10:09:01 +0000 Received: (at 75144) by debbugs.gnu.org; 13 Mar 2025 10:08:06 +0000 Received: from localhost ([127.0.0.1]:53823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tsfTx-000402-Ga for submit@debbugs.gnu.org; Thu, 13 Mar 2025 06:08:06 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:49270) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tsfTs-0003zU-00 for 75144@debbugs.gnu.org; Thu, 13 Mar 2025 06:08:03 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-aaecf50578eso132775566b.2 for <75144@debbugs.gnu.org>; Thu, 13 Mar 2025 03:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1741860474; x=1742465274; darn=debbugs.gnu.org; h=mime-version:message-id:date:user-agent:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=0VCqU8vBEXRl6Fkhx7eG57peNvRnPY45aSRE6U71mV0=; b=E9MGtB5NIsUAyrdsZH0OgTRBDlMBiZsvCZFE5IfFHuKyAstpJJXugKxTR+SGyrQttL gR4tFY/GU1y/XUUXPjlaSM1gmKbpNctbc1jGKzn6RKsxCZ6KXHmvxNVy/nA8baY/NeTI zNalC1igkdGfioupJDiYy2l5Uh73JhhVhdO6wWyH1GdJVULZVDmijtvRb5ya+MVOrWws HLZAh8s4uTDpVtEM//fz6Kkd0cUEKp6odzyXtCcWM5U4CV3SpEqgA8P0xs5TLoM9KNch 70RW0WFFASFSwA+tcuGnRX1Yj3WrEWBoiTqH7zhjCkhqvc8b2ZEBkA627MDdt+Q/iviN Mrfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741860474; x=1742465274; h=mime-version:message-id:date:user-agent:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0VCqU8vBEXRl6Fkhx7eG57peNvRnPY45aSRE6U71mV0=; b=uQMPgvrEjhQWVTP/kxdGSyPtI1Fg/J2uggRkXH5I1ewQhGCMG3od1LgO/gIqV6SXlU D2h/obOSv+k1cecqPlj5szWWvCnBC/u1cTTh6VL/qqzR6LCHiStvoqkY6o0ENN5tY5Cb zI36VSFJoKTNBHxSVIJQ555fOlKWW3DxhMZa3+cpIy4buUerm0Ht6NUgQew8Qigy+GPC f8nP5mWGwL477mXC3uSri77TMLLPQBTCny0oKCPjHHdOabXTGqTKXVAR3DRCZkEZBdaZ n9c0Xrp1T/v1fLovBqYQVmVtYjr3YFf3/jTss6LC9117gd3/kEyZQEdygiMQitX1ZcF1 dhtA== X-Gm-Message-State: AOJu0Yz25o9ajxbtFQqoUmxRy0BjCfovByr78jQxlR5WJeit4Z3iM2fI Um8TfcF0NlNeYuulhNuAgiK25QnV95wpqrawOlW6wzgT44PN0HZNEc8cIgoFc10= X-Gm-Gg: ASbGncuzfnhjsDVbMx2D/6MA36hHBe6wgic6Aqmd+PaVI3FjYB3YmMD1uzcIFBUMobQ MzScNqEfqW9cDE2aSdfBNu8OeYFDrUD0bmk1f+4EUwFYgq7TaP9eMD9j7bKyoXlFKuksmWun2+O GLbb2GDLctzAMXdRKa2Ish76U8OPbthyDtsaFyGrovrMKVbaiIZpTMwFpP4k0/2QnXOkMh79Iw0 jBe4xAaDCEHvozJZ4sk/rYkInEYFaQJI+VrBtntGc1ZoZyhVPb/noNr07aDdk3WDi+DvKID1LrK ZMUjMF7U+nw6aSvHfjZlP5BrIH6+aCNCo1kpwu9+2vV+nx6LrFs= X-Google-Smtp-Source: AGHT+IGWuhwKoXhVU/Mys36iIJLmC6UNg0YKI+3vtySBlEaDdo22g1xFZ5amwi+ZERErbHFeaLeXkQ== X-Received: by 2002:a17:907:8283:b0:ac2:7a97:87fb with SMTP id a640c23a62f3a-ac27a978b3bmr2197571766b.33.1741860473591; Thu, 13 Mar 2025 03:07:53 -0700 (PDT) Received: from thinkpad ([2a02:2454:a0a5:2400:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3149ce9a9sm61380766b.110.2025.03.13.03.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 03:07:53 -0700 (PDT) User-Agent: mu4e 1.12.9; emacs 30.0.92 Date: Thu, 13 Mar 2025 11:07:50 +0100 Message-ID: <87jz8t451l.fsf@sarg.org.ru> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Sergey Trofimov X-ACL-Warn: , Sergey Trofimov via Guix-patches X-Patchwork-Original-From: Sergey Trofimov via Guix-patches via From: Sergey Trofimov Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hi Roman, Roman Scherer writes: > * gnu/machine/hetzner.scm: New file. > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > * guix/ssh.scm (open-ssh-session): Add stricthostkeycheck option. > * doc/guix.texi (Invoking guix deploy): Add documentation for > 'hetzner-configuration'. > That's a very welcome change and I'm glad it is merged already. I've given it a try and stumbled upon some errors. See them below. I started with the minimal configuration similar to the example from docs. --8<---------------cut here---------------start------------->8--- (hetzner-configuration (server-type "cax11") (location "hel1") (ssh-key ".../id_rsa")) --8<---------------cut here---------------end--------------->8--- Deploying it worked only half-way - the server got created, but deploying actual OS failed due to my host (x86_64) not able to build derivations for aarch64-linux. This one I fixed by adding `qemu-binfmt-service-type` to my system config. Second deployment attempt picked up the work (that's nice!) and started building the derivations. After about 40 minutes I'd aborted it, although I'm pretty sure it would've completed successfully. I just didn't want to wait too long. Next I've addded `(build-locally? #f)` to the VM config and repeated the deployment. This one progressed much quicker, however it failed while building `linux-modules`: --8<---------------cut here---------------start------------->8--- building path(s) `/gnu/store/lsa1716vbccxf9flpnzbfqzbm9rh4ljl-linux-modules' Backtrace: 18 (primitive-load "/gnu/store/mfk843zl41s21banhzwkyfdxapa?") In ice-9/eval.scm: 619:8 17 (_ #f) 626:19 16 (_ #) 293:34 15 (_ #(# #)) In srfi/srfi-1.scm: 586:29 14 (map1 _) 586:29 13 (map1 _) 586:29 12 (map1 _) 586:29 11 (map1 _) 586:29 10 (map1 _) 586:29 9 (map1 _) 586:29 8 (map1 _) 586:29 7 (map1 _) 586:29 6 (map1 _) 586:29 5 (map1 _) 586:29 4 (map1 _) 586:29 3 (map1 _) 586:29 2 (map1 _) 586:17 1 (map1 ("pata_acpi" "pata_atiixp" "isci" "virtio_pci" # ?)) In gnu/build/linux-modules.scm: 278:5 0 (_) gnu/build/linux-modules.scm:278:5: kernel module not found "pata_acpi" "/gnu/store/nh5icvr5qvlaq1y54gpkqndy0rv2cq9r-linux-libre-6.13.6/lib/modules" --8<---------------cut here---------------end--------------->8--- This seem to be caused by `deploy` not supporting `--target` parameter. Adding these looked simple and I've jotted a small patch: --8<---------------cut here---------------start------------->8--- From 0d438d2fadc95fbe2eca73fc3c7f4278d58829d7 Mon Sep 17 00:00:00 2001 Message-ID: <0d438d2fadc95fbe2eca73fc3c7f4278d58829d7.1741858564.git.sarg@sarg.org.ru> From: Sergey Trofimov Subject: [PATCH] Support --target and --system in guix deploy --- guix/scripts/deploy.scm | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) base-commit: 9449ab3c2025820d2e6fd679fa7e34832b667ea7 -- 2.48.1 --8<---------------cut here---------------end--------------->8--- I wasn't able to confirm the patch works as during the deployment it tries to build the toolchain which I can't afford on my host: --8<---------------cut here---------------start------------->8--- The following derivations will be built: /gnu/store/gxr8v1yisdiyndka0abxrc0xzrra66sv-binutils-cross-aarch64-linux-gnu-2.41.drv /gnu/store/lch3711iiczn6smxsr7r3sj991p8avwv-ld-wrapper-aarch64-linux-gnu-0.drv /gnu/store/zmsnlbyml0vmphfdxyxw4ps25bgrwz92-gcc-cross-sans-libc-aarch64-linux-gnu-14.2.0.drv /gnu/store/57jnlmvqlvk6jkyvqcnrk4psffhmak91-linux-libre-headers-cross-aarch64-linux-gnu-5.15.49.drv /gnu/store/b4f1my595ggl7d5qn46vr6qllwx7g49z-glibc-cross-aarch64-linux-gnu-2.39.drv /gnu/store/sl5vfnwdarghf9ypbspq1bdlamnz3j2a-gcc-cross-aarch64-linux-gnu-14.2.0.drv /gnu/store/3vp8a7mz1576xbk278k9b73nx2zqmzlw-libffi-3.4.4.drv /gnu/store/5ij0pv5z7mi25r397y4k62ma7q38qrka-pkg-config-aarch64-linux-gnu-0.29.2.drv /gnu/store/y3hqwsbc8rb2g1mac8c9vsdmaacf20xm-libatomic-ops-7.6.12.drv /gnu/store/bd09d178ni5sp9db62w869c6m7d3sh6v-libgc-8.2.4.drv /gnu/store/cs7mzhrypgdad8v0v29arafc8brl7ynd-bash-minimal-5.1.16.drv /gnu/store/np51g0ak713az6shj6sv9j3wkq4cjvjx-libunistring-1.1.drv /gnu/store/rbkb4ig158h9gblbrah5nx5annvfpb4q-libxcrypt-4.4.36.drv /gnu/store/lfmamfv5vx690l9n6a1ixbbk6kzw3gsr-guile-3.0.9.drv --8<---------------cut here---------------end--------------->8--- Finally, I want to highlight a couple things that I haven't figured out for my use-case yet: 1. My private ssh key is stored in GnuPG and I'd like to keep it that way. Afaik `managed-host-environment-type` can utilise the running ssh-agent, could it be also implemented for hetzner machines? 2. My use-case is an on-demand wireguard VPN. In my current setup I have created a static ipv6 address which I attach to the VM created using `hcloud`. The wireguard config hardcodes the same ipv6 and is installed on the VM during cloud-init provision (`--user-data-from-file` parameter). To replicate the same in guix deploy, `hetzner-configuration` should be more flexible in regards to public ip addresses. I.e. it should allow to use either v4 or v6 and to accept existing one provided by the user. diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm index e2ef0006e0..5b6c6b8e79 100644 --- a/guix/scripts/deploy.scm +++ b/guix/scripts/deploy.scm @@ -26,6 +26,7 @@ (define-module (guix scripts deploy) #:use-module (guix scripts) #:use-module (guix scripts build) #:use-module (guix store) + #:use-module (guix utils) #:use-module (guix gexp) #:use-module (guix ui) #:use-module ((guix status) #:select (with-status-verbosity)) @@ -93,21 +94,22 @@ (define %options (option '(#\x "execute") #f #f (lambda (opt name arg result) (alist-cons 'execute-command? #t result))) - (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) (option '(#\v "verbosity") #t #f (lambda (opt name arg result) (let ((level (string->number* arg))) (alist-cons 'verbosity level (alist-delete 'verbosity result))))) - %standard-build-options)) + (append + %standard-build-options + %standard-native-build-options + %standard-cross-build-options))) (define %default-options ;; Alist of default option values. `((verbosity . 1) + (system . ,(%current-system)) + (target . #f) (debug . 0) (graft? . #t) (substitutes? . #t) @@ -186,9 +188,13 @@ (define (deploy-machine* store machine) (when (deploy-error-should-roll-back c) (info (G_ "rolling back ~a...~%") (machine-display-name machine)) - (run-with-store store (roll-back-machine machine))) + (run-with-store store (roll-back-machine machine) + #:system (%current-system) + #:target (%current-target-system))) (apply throw (deploy-error-captured-args c)))) - (run-with-store store (deploy-machine machine)) + (run-with-store store (deploy-machine machine) + #:system (%current-system) + #:target (%current-target-system)) (info (G_ "successfully deployed ~a~%") (machine-display-name machine)))) @@ -266,7 +272,9 @@ (define (invoke-command store machine command) (loop (cons line lines)))))))) (match (run-with-store store - (machine-remote-eval machine invocation)) + (machine-remote-eval machine invocation) + #:system (%current-system) + #:target (%current-target-system)) ((code output) (match code ((? zero?) @@ -325,7 +333,9 @@ (define-command (guix-deploy . args) #:verbosity (assoc-ref opts 'verbosity) #:dry-run? dry-run?) - (parameterize ((%graft? (assq-ref opts 'graft?))) + (parameterize ((%graft? (assq-ref opts 'graft?)) + (%current-target-system (assoc-ref opts 'target)) + (%current-system (assoc-ref opts 'system))) (if execute-command? (match command (("--" command ..1)