Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure: nixStatic (bash: Argument list too long) #357949

Open
heywoodlh opened this issue Nov 21, 2024 · 1 comment
Open

Build failure: nixStatic (bash: Argument list too long) #357949

heywoodlh opened this issue Nov 21, 2024 · 1 comment
Labels
0.kind: build failure A package fails to build

Comments

@heywoodlh
Copy link
Contributor

How does one actually build nixStatic without a full installation of Nix, such as with the Nix official docker image? It'd be nice to do a multi-stage Docker build like so:

FROM docker.io/nixos/nix AS nix-static-builder

RUN nix --extra-experimental-features "flakes nix-command" build -o /tmp/nix nixpkgs#nixStatic

FROM alpine

COPY --from=nix-static-builder /tmp/nix/bin/nix /usr/bin/nix

Also, is there any predictable URL to grab the static binary besides directly from Hydra? This seems to work for me:

nix run "nixpkgs#curl" -- -L https://hydra.nixos.org/job/nix/maintenance-$(nix --version | nix run "nixpkgs#gawk" -- '{print $3}' | cut -d'.' -f1-2)/buildStatic.nix.$(nix run "nixpkgs#busybox" -- arch)-linux/latest/download-by-type/file/binary-dist -o /nix-bin \
    && chmod +x /nix-bin

😄

Steps To Reproduce

Steps to reproduce the behavior:

  1. Attempt to build nixStatic without downloading from the binary cache, i.e. docker run -it --rm docker.io/nixos/nix nix --extra-experimental-features 'nix-command flakes' build -o /tmp/nix nixpkgs#nixStatic

  2. My laptop running NixOS seems to build it just fine -- but I suspect it's pulling down from the binary cache

Build log

Build Log

(I can get the entire log if desired/needed -- I don't think it's necessary for this example)

❯ docker run -it --rm docker.io/nixos/nix nix --extra-experimental-features 'nix-command flakes' build -o /tmp/nix nixpkgs#nixStatic
error: builder for '/nix/store/28d5l059yypca26g7iria6yixg70q4rp-nix-static-x86_64-unknown-linux-musl-2.24.10.drv' failed with exit code 2;
       last 25 log lines:
       >   AR     src/libmain/libnixmain.a
       >   LD     src/libflake/libnixflake.a
       >   AR     src/libfetchers/libnixfetchers.a
       >   AR     src/libflake/libnixflake.a
       >   LD     src/libcmd/libnixcmd.a
       >   LD     tests/unit/libutil-support/libnixutil-test-support.a
       >   AR     tests/unit/libutil-support/libnixutil-test-support.a
       >   LD     src/libutil-c/libnixutilc.a
       >   AR     src/libutil-c/libnixutilc.a
       >   LD     tests/unit/libstore-support/libnixstore-test-support.a
       >   LD     src/libstore-c/libnixstorec.a
       >   AR     src/libstore-c/libnixstorec.a
       >   LD     tests/unit/libexpr-support/libnixexpr-test-support.a
       >   AR     tests/unit/libexpr-support/libnixexpr-test-support.a
       >   LD     src/libexpr-c/libnixexprc.a
       >   AR     tests/unit/libstore-support/libnixstore-test-support.a
       >   LD     tests/unit/libutil/libnixutil-tests
       >   AR     src/libcmd/libnixcmd.a
       >   AR     src/libexpr-c/libnixexprc.a
       >   LD     src/libexpr/libnixexpr.a
       >   AR     src/libexpr/libnixexpr.a
       >   LD     src/libstore/libnixstore.a
       >   AR     src/libstore/libnixstore.a
       > make: /nix/store/0irlcqx2n3qm6b1pc9rsd2i8qpvcccaj-bash-5.2p37/bin/bash: Argument list too long
       > make: *** [mk/lib.mk:85: src/nix/nix] Error 127
       For full logs, run 'nix log /nix/store/28d5l059yypca26g7iria6yixg70q4rp-nix-static-x86_64-unknown-linux-musl-2.24.10.drv'.

Additional context

Metadata

Notify maintainers

@edolstra
@lovesegfault
@Artturin


Note for maintainers: Please tag this issue in your PR.


Add a 👍 reaction to issues you find important.

@heywoodlh heywoodlh added the 0.kind: build failure A package fails to build label Nov 21, 2024
@celesrenata
Copy link

I get this failure in 24.05 when trying to upgrade, or from unstable trying to install 24.11, distributive builds also fail on this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build
Projects
None yet
Development

No branches or pull requests

2 participants