diff options
| author | Thiago Jung Bauermann <bauermann@kolabnow.com> | 2022-11-03 22:54:56 -0300 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2022-11-04 08:46:11 +0100 |
| commit | a75deb884468db0ce2c35e23a61f1a14c9be958e (patch) | |
| tree | cd9914f6ac7d8c1cd64f4f895e2023cd6ca0a570 /gnu/system | |
| parent | e3280ae8b5c4aaf28eb6de8406215927923a4dff (diff) | |
system: image: Define correct docker image arch when cross building
Cross-building a docker image with:
$ guix system image --image-type=docker --target=aarch64-linux-gnu os.scm
results in an image where the architecture declared in its config.json is
the host architecture rather than the target one. The binaries are
correctly cross-compiled, so the image can be loaded and used despite the
warning message shown by docker:
$ docker load -i vcal7bvsqcijchifhqdvprpd1niqh8sk-docker-image.tar.gz
Loaded image: guix:latest
$ docker create guix:latest
WARNING: The requested image's platform (linux/amd64) does not match the
detected host platform (linux/arm64/v8) and no specific platform was
requested
40f06aa869ed690489c4a3824a7f7721bd4bf453b85f25ac7199266939fe2fba
$ echo $?
0
This is fixed by passing the correct triplet to the build-docker-image
function.
* gnu/system/image.scm (system-docker-image) Add ‘image-target’ variable.
[builder]: Pass ‘#:system’ argument to ‘build-docker-image’.
Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'gnu/system')
| -rw-r--r-- | gnu/system/image.scm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 5fc0d55d9a1..f07a4a52174 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm | |||
| @@ -652,6 +652,8 @@ output file." | |||
| 652 | shared-network?) | 652 | shared-network?) |
| 653 | (list boot-program))) | 653 | (list boot-program))) |
| 654 | (substitutable? (image-substitutable? image)) | 654 | (substitutable? (image-substitutable? image)) |
| 655 | (image-target (or (%current-target-system) | ||
| 656 | (nix-system->gnu-triplet))) | ||
| 655 | (register-closures? (has-guix-service-type? os)) | 657 | (register-closures? (has-guix-service-type? os)) |
| 656 | (schema (and register-closures? | 658 | (schema (and register-closures? |
| 657 | (local-file (search-path %load-path | 659 | (local-file (search-path %load-path |
| @@ -705,6 +707,7 @@ output file." | |||
| 705 | #:entry-point '(#$boot-program #$os) | 707 | #:entry-point '(#$boot-program #$os) |
| 706 | #:compressor '(#+(file-append gzip "/bin/gzip") "-9n") | 708 | #:compressor '(#+(file-append gzip "/bin/gzip") "-9n") |
| 707 | #:creation-time (make-time time-utc 0 1) | 709 | #:creation-time (make-time time-utc 0 1) |
| 710 | #:system #$image-target | ||
| 708 | #:transformations `((,image-root -> "")))))))) | 711 | #:transformations `((,image-root -> "")))))))) |
| 709 | 712 | ||
| 710 | (computed-file name builder | 713 | (computed-file name builder |
