dockerTools: use go.GOARCH as default arch
This commit is contained in:
parent
d4b7efe531
commit
5cacf0fcec
@ -58,15 +58,12 @@ let
|
|||||||
done;
|
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
|
# Reference: https://github.com/opencontainers/image-spec/blob/master/config.md#properties
|
||||||
getArch = nixSystem: {
|
# For the mapping from Nixpkgs system parameters to GOARCH, we can reuse the
|
||||||
aarch64-linux = "arm64";
|
# mapping from the go package.
|
||||||
armv7l-linux = "arm";
|
defaultArch = go.GOARCH;
|
||||||
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.";
|
|
||||||
|
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
@ -84,7 +81,7 @@ rec {
|
|||||||
, imageDigest
|
, imageDigest
|
||||||
, sha256
|
, sha256
|
||||||
, os ? "linux"
|
, os ? "linux"
|
||||||
, arch ? getArch system
|
, arch ? defaultArch
|
||||||
|
|
||||||
# This is used to set name to the pulled image
|
# This is used to set name to the pulled image
|
||||||
, finalImageName ? imageName
|
, finalImageName ? imageName
|
||||||
@ -500,7 +497,7 @@ rec {
|
|||||||
baseJson = let
|
baseJson = let
|
||||||
pure = writeText "${baseName}-config.json" (builtins.toJSON {
|
pure = writeText "${baseName}-config.json" (builtins.toJSON {
|
||||||
inherit created config;
|
inherit created config;
|
||||||
architecture = getArch system;
|
architecture = defaultArch;
|
||||||
os = "linux";
|
os = "linux";
|
||||||
});
|
});
|
||||||
impure = runCommand "${baseName}-config.json"
|
impure = runCommand "${baseName}-config.json"
|
||||||
@ -754,7 +751,7 @@ rec {
|
|||||||
streamScript = writePython3 "stream" {} ./stream_layered_image.py;
|
streamScript = writePython3 "stream" {} ./stream_layered_image.py;
|
||||||
baseJson = writeText "${name}-base.json" (builtins.toJSON {
|
baseJson = writeText "${name}-base.json" (builtins.toJSON {
|
||||||
inherit config;
|
inherit config;
|
||||||
architecture = getArch system;
|
architecture = defaultArch;
|
||||||
os = "linux";
|
os = "linux";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user