Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

feat: added support for specifying arch when building an image#45

Merged
dbarrosop merged 1 commit into
mainfrom
arch
Jun 16, 2025
Merged

feat: added support for specifying arch when building an image#45
dbarrosop merged 1 commit into
mainfrom
arch

Conversation

@dbarrosop

@dbarrosop dbarrosop commented Jun 16, 2025

Copy link
Copy Markdown
Member

PR Type

Enhancement


Description

• Added architecture parameter support to Docker image building functions
• Set default architecture to pkgs.go.GOARCH for both generic and Go-specific builders
• Enhanced dockerImageFn and docker-image functions with arch configuration
• Improved cross-platform Docker image building capabilities


Changes walkthrough 📝

Relevant files
Enhancement
generic.nix
Add architecture parameter to generic Docker functions     

lib/generic/generic.nix

• Added arch parameter with default value pkgs.go.GOARCH to
dockerImageFn
• Updated function calls to pass arch parameter to
nix2container.buildImage
• Enhanced docker-image function with
architecture support

+4/-2     
go.nix
Add architecture parameter to Go Docker functions               

lib/go/go.nix

• Added arch parameter with default value pkgs.go.GOARCH to
Go-specific dockerImageFn
• Updated function signatures and calls to
include architecture parameter
• Enhanced Go Docker image building
with cross-platform support

+4/-2     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions

    Copy link
    Copy Markdown
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Default Value

    The default architecture value pkgs.go.GOARCH may not be appropriate for generic Docker images that are not Go-specific. Consider using a more generic default or making arch a required parameter.

    , arch ? pkgs.go.GOARCH
    Missing Parameter

    The config parameter is not being passed to the underlying nix2container.buildImage function, which could cause configuration settings to be ignored.

    inherit name created maxLayers arch;

    @github-actions

    Copy link
    Copy Markdown
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Remove unnecessary Go dependency

    Using pkgs.go.GOARCH as default for arch parameter creates an unnecessary dependency
    on Go packages even when Go is not used. Consider using
    pkgs.stdenv.hostPlatform.parsed.cpu.name or a more generic platform-specific default
    that doesn't require Go.

    lib/generic/generic.nix [11]

    -, arch ? pkgs.go.GOARCH
    +, arch ? pkgs.stdenv.hostPlatform.parsed.cpu.name
    Suggestion importance[1-10]: 7

    __

    Why: Valid suggestion to remove unnecessary Go dependency in generic code. Using pkgs.stdenv.hostPlatform.parsed.cpu.name is more appropriate for generic Docker image building.

    Medium

    @dbarrosop dbarrosop merged commit 1ed1112 into main Jun 16, 2025
    3 checks passed
    @dbarrosop dbarrosop deleted the arch branch June 16, 2025 12:43
    Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants