summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2020-12-13 00:42:31 +0100
committerTerin Stock <terinjokes@gmail.com>2020-12-15 02:15:35 -0800
commit5cacf0fcecdde29b1e72d729fea0e922df29ed02 (patch)
treec0cd1583e5573a87210e78a0fa853fbb16c18145
parentd4b7efe5317bcd63e355cc630fa8650708c93325 (diff)
dockerTools: use go.GOARCH as default arch
-rw-r--r--pkgs/build-support/docker/default.nix19
1 files changed, 8 insertions, 11 deletions
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix
index 93c32c68a962..276c7cd1bdb8 100644
--- a/pkgs/build-support/docker/default.nix
+++ b/pkgs/build-support/docker/default.nix
@@ -58,15 +58,12 @@ let
done;
'';
- # Map nixpkgs architecture to OCI recomendation
+ # The OCI Image specification recommends that configurations use values listed
+ # in the Go Language document for GOARCH.
# Reference: https://github.com/opencontainers/image-spec/blob/master/config.md#properties
- getArch = nixSystem: {
- aarch64-linux = "arm64";
- armv7l-linux = "arm";
- x86_64-linux = "amd64";
- powerpc64le-linux = "ppc64le";
- i686-linux = "386";
- }.${nixSystem} or "Can't map Nix system ${nixSystem} to Docker architecture. Please check that your input and your requested build are correct or update the mapping in Nixpkgs.";
+ # For the mapping from Nixpkgs system parameters to GOARCH, we can reuse the
+ # mapping from the go package.
+ defaultArch = go.GOARCH;
in
rec {
@@ -84,7 +81,7 @@ rec {
, imageDigest
, sha256
, os ? "linux"
- , arch ? getArch system
+ , arch ? defaultArch
# This is used to set name to the pulled image
, finalImageName ? imageName
@@ -500,7 +497,7 @@ rec {
baseJson = let
pure = writeText "${baseName}-config.json" (builtins.toJSON {
inherit created config;
- architecture = getArch system;
+ architecture = defaultArch;
os = "linux";
});
impure = runCommand "${baseName}-config.json"
@@ -754,7 +751,7 @@ rec {
streamScript = writePython3 "stream" {} ./stream_layered_image.py;
baseJson = writeText "${name}-base.json" (builtins.toJSON {
inherit config;
- architecture = getArch system;
+ architecture = defaultArch;
os = "linux";
});