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 · 3 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.

@IgorRSGraziano
Copy link

IgorRSGraziano commented Jul 15, 2024

i have same error on tinycc-musl-unstable-2023-07-10-compiler , but I'm trying to download the binutils package in a desktop environment

@RyanGibb
Copy link

RyanGibb commented Jul 17, 2024

I also get this error in and outside docker container upon nix-env -i gnutar or nix-env -i binutils.

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

@skull-squadron
Copy link

nix-env -i bash fails like the above on aarch64 docker but nix-env -iA nixpkgs.bash works. Inconsistent footguns are really out in force with protective landmines.

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

4 participants