Subject: [bug#77033] [PATCH] deploy: Support --target and --system.

From: Sergey Trofimov <[email-masked]>
Date: Mon, 17 Mar 2025 21:33:33 +0100

Hi Roman,

Roman Scherer <[email-masked]> writes:

> So, I tried building this machine on an aarch64 system with the qemu-bin
> service running now a couple of times ...
>
> ```
> (use-modules (gnu machine)
>              (gnu machine hetzner))
>
> (list (machine
>        (operating-system %hetzner-os-x86)
>        (environment hetzner-environment-type)
>        (configuration (hetzner-configuration
>                        (server-type "cx42")
>                        (ssh-key "/home/roman/workspace/guix/id_rsa")))))
> ```
>
> I used this command:
>
> ```
> [roman@m1 guix]$ ./pre-inst-env guix deploy hetzner-minimal.scm --no-offload --target=x86_64-linux-gnu --timeout=864000 --max-silent-time=864000
> The following 1 machine will be deployed:
>   guix-x86
>
> guix deploy: deploying to guix-x86...
> guix deploy: warning: <machine-ssh-configuration> without a 'host-key' is deprecated
> substitute: looking for substitutes on 'https://substitutes.asahi-guix.org'... 100.0%
> substitute: looking for substitutes on 'https://substitutes.nonguix.org'... 100.0%
> substitute: looking for substitutes on 'https://bordeaux.guix.gnu.org'... 100.0%
> substitute: looking for substitutes on 'https://ci.guix.gnu.org'... 100.0%
> The following derivations will be built:
>   /gnu/store/0ma7qrdd5pz8421rka75mvmvhkvn1rld-libxcrypt-4.4.36.drv
>   /gnu/store/8js0zmi3c2zg7ks3qnpiwsckam37vi67-guile-3.0.9.drv
>
> building /gnu/store/0ma7qrdd5pz8421rka75mvmvhkvn1rld-libxcrypt-4.4.36.drv...
> ```
>
> And it always "hangs" there. I haven't much investigated this yet. Just
> a small update.
>

You could try `guix build
/gnu/store/0ma7qrdd5pz8421rka75mvmvhkvn1rld-libxcrypt-4.4.36.drv` to see
what it does and where it hangs.

Also try `--system=x86_64-linux`, it should be fast.

>> I don't see a "system" field in the machine or operating system
>> record. So I'm not sure if we have a way to infer that yet.
>>
>> Would it make sense to add such a field and chose the target
>> architecture per machine?
>>

This totally makes sense to me and is the correct way. However I wonder
if both the `system` and the `target` fields should be added, so that
the user could choose either native or cross build. From my experience
"native" build (as provided by qemu) is much faster. I'll try running
a cross build tomorrow, but it is painfully slow to build the toolchain
on my machine:

--8<---------------cut here---------------start------------->8---
The following 1 machine will be deployed:
  guix-arm

guix deploy: deploying to guix-arm, system=x86_64-linux, target=aarch64-linux-gnu...
guix deploy: warning: <machine-ssh-configuration> without a 'host-key' is deprecated
substitute: looking for substitutes on 'https://substitutes.nonguix.org'... 100.0%
substitute: looking for substitutes on 'https://bordeaux.guix.gnu.org'... 100.0%
substitute: looking for substitutes on 'https://ci.guix.gnu.org'... 100.0%
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/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---