Skip to content

Symlink generated by nix build and the --store parameter is incorrect #2264

@edude03

Description

@edude03

Here is an easy example to reproduce:

docker run -ti lnl7/nix:2.0 bash
bash-4.4# mkdir test
bash-4.4# nix build --store $PWD/test nixpkgs.hello
[2 copied (24.0 MiB), 6.0 MiB DL]
bash-4.4# ls -al result
lrwxrwxrwx 1 root root 54 Jun 30 05:49 result -> /nix/store/6mab2znnw7j96k3vsdw9vyckady29r46-hello-2.10
bash-4.4# ls /nix/store/6mab2znnw7j96k3vsdw9vyckady29r46-hello-2.10
ls: cannot access '/nix/store/6mab2znnw7j96k3vsdw9vyckady29r46-hello-2.10': No such file or directory

However if you concatenate the path the symlink generates with the store path like so:

bash-4.4# ls $PWD/test/nix/store/6mab2znnw7j96k3vsdw9vyckady29r46-hello-2.10
bin  share

It works.

For now my workaround is setting $NIX_CUSTOM_STORE and doing output_path = $NIX_CUSTOM_STORE$(readlink result)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions