From c5c91aef5a51cb476324478696572dd3bbac2dff Mon Sep 17 00:00:00 2001 From: David Barroso Date: Mon, 16 Jun 2025 14:24:41 +0200 Subject: [PATCH] feat: added support for specifying arch --- lib/generic/generic.nix | 6 ++++-- lib/go/go.nix | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/generic/generic.nix b/lib/generic/generic.nix index d45dd63..7dd2a36 100644 --- a/lib/generic/generic.nix +++ b/lib/generic/generic.nix @@ -8,9 +8,10 @@ let , copyToRoot ? null , maxLayers ? 100 , config ? { } + , arch ? pkgs.go.GOARCH }: nix2containerPkgs.nix2container.buildImage { - inherit name tag created copyToRoot fromImage maxLayers config; + inherit name tag created copyToRoot fromImage maxLayers config arch; }; in { @@ -22,10 +23,11 @@ in , copyToRoot ? null , maxLayers ? 100 , config ? { } + , arch ? pkgs.go.GOARCH }: pkgs.runCommand "image-as-dir" { } '' ${(dockerImageFn { - inherit name tag created fromImage copyToRoot maxLayers config; + inherit name tag created fromImage copyToRoot maxLayers config arch; }).copyTo}/bin/copy-to dir:$out ''; } diff --git a/lib/go/go.nix b/lib/go/go.nix index 0fdd77b..f423a41 100644 --- a/lib/go/go.nix +++ b/lib/go/go.nix @@ -17,11 +17,12 @@ let , package , buildInputs , maxLayers + , arch ? pkgs.go.GOARCH , contents ? [ ] , config ? { } }: nix2containerPkgs.nix2container.buildImage { - inherit name created maxLayers; + inherit name created maxLayers arch; tag = version; copyToRoot = pkgs.buildEnv { @@ -168,12 +169,13 @@ in , package , buildInputs , maxLayers ? 100 + , arch ? pkgs.go.GOARCH , contents ? [ ] , config ? { } }: pkgs.runCommand "image-as-dir" { } '' ${(dockerImageFn { - inherit name version created package buildInputs maxLayers contents config; + inherit name version created package buildInputs maxLayers arch contents config; }).copyTo}/bin/copy-to dir:$out ''; }