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

Default docker example doesn't work #1415

Open
1 task
ctron opened this issue May 3, 2024 · 2 comments
Open
1 task

Default docker example doesn't work #1415

ctron opened this issue May 3, 2024 · 2 comments
Labels

Comments

@ctron
Copy link

ctron commented May 3, 2024

Introduce your stance

I want to build a nix package using docker/podman.

Describe the issue

The documentation at https://nixos.org/download/#nix-install-docker says:

$ git clone --depth=1 https://github.com/NixOS/nixpkgs.git
$ docker run -it -v $(pwd)/nixpkgs:/nixpkgs nixos/nix
docker> nix-build -I nixpkgs=/nixpkgs -A hello
docker> find ./result # this symlink points to the build package

However, that results in:

bash-5.2# nix-build -I nixpkgs=/nixpkgs -A hello
error: path '/default.nix' does not exist

I have no idea how to resolve this.

Page links

Additional context
Add any other context about the problem here.

  • I already created a Pull Request
@ctron ctron added the content label May 3, 2024
@nat-418
Copy link

nat-418 commented May 26, 2024

Yeah the docker-compose stuff didn't work for me either:

 $ docker-compose up
[+] Building 0.1s (2/2) FINISHED                                      docker:default
 => [nixos-homepage internal] load .dockerignore                                0.0s
 => => transferring context: 2B                                                 0.0s
 => [nixos-homepage internal] load build definition from Dockerfile             0.0s
 => => transferring dockerfile: 2B                                              0.0s
failed to solve: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount163813011/Dockerfile: no such file or directory

@mcdonc
Copy link

mcdonc commented Jun 21, 2024

For the record, the fix is to change:

nix-build -I nixpkgs=/nixpkgs -A hello

To:

nix-build -I nixpkgs=/nixpkgs -A hello nixpkgs/default.nix

I'm not sure where in the nixpkgs repository to change this so the website isn't lies, though.

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

3 participants