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

Building docker image with nixos/nix fails with error: Package ‘tinycc-musl-unstable-2023-07-10-compiler’ in «unknown-file» is not available on the requested hostPlatform #10587

Open
Xelef2000 opened this issue Apr 22, 2024 · 0 comments
Labels

Comments

@Xelef2000
Copy link

Describe the bug

I tried using the nixos/nix container to build docker containers in a 2-stage build process.
It works with some images, like redis, but fails with others, like bash.

This is the error I get:

5.29 installing 'bash-5.2.15'
15.42 error:
15.42        … while calling the 'derivationStrict' builtin
15.42          at <nix/derivation-internal.nix>:9:12:
15.42             8|
15.42             9|   strict = derivationStrict drvAttrs;
15.42              |            ^
15.42            10|
15.42 
15.42        … while evaluating derivation 'bash-5.2.15'
15.42          whose name attribute is located at /nix/store/6nnv8z57j976ij3img6ni46fkbac9vb0-nixpkgs/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix:81:15
15.42 
15.42        … while evaluating attribute 'PATH' of derivation 'bash-5.2.15'
15.42          at /nix/store/6nnv8z57j976ij3img6ni46fkbac9vb0-nixpkgs/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix:104:7:
15.42           103|       SHELL = "${bash_2_05}/bin/bash";
15.42           104|       PATH = lib.makeBinPath ((env.nativeBuildInputs or []) ++ [
15.42              |       ^
15.42           105|         bash_2_05
15.42 
15.42        (stack trace truncated; use '--show-trace' to show the full trace)
15.42 
15.42        error: Package ‘tinycc-musl-unstable-2023-07-10-compiler’ in «unknown-file» is not available on the requested hostPlatform:
15.42          hostPlatform.config = "x86_64-unknown-linux-gnu"
15.42          package.meta.platforms = [
15.42            "i686-linux"
15.42          ]
15.42          package.meta.badPlatforms = [ ]
15.42        , refusing to evaluate.
15.42 
15.42        a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
15.42           for a single invocation of the nix tools.
15.42 
15.42             $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
15.42 
15.42           Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
15.42                 then pass `--impure` in order to allow use of environment variables.
15.42 
15.42        b) For `nixos-rebuild` you can set
15.42          { nixpkgs.config.allowUnsupportedSystem = true; }
15.42        in configuration.nix to override this.
15.42 
15.42        c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
15.42          { allowUnsupportedSystem = true; }
15.42        to ~/.config/nixpkgs/config.nix.

When adding the NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 env var, the build fails with a 904.2 ./arch/x32/crt_arch.h:12: error: unknown register %rbp

Steps To Reproduce

  1. Build this Dockerfile:
FROM nixos/nix
RUN mkdir -p /output/store
RUN nix-channel --update
RUN nix-env --profile /output/profile -i bash

RUN cp -va $(nix-store -qR /output/profile) /output/store

FROM scratch
COPY --from=0 /output/store /nix/store
COPY --from=0 /output/profile/ /usr/local/
ENTRYPOINT [ "/usr/local/bin/bash" ]

Expected behavior

The container should be built successfully.

@Xelef2000 Xelef2000 added the bug label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant